onscrolltopchanging / onscrolltopchanged
i am trying to create a grid inside another grid by setting the positions - technically, a grid on top of another grid. however, i have a problem when scrolling. the onScrollTopChanged / onScrollTopChanging events seem to fire twice. and there is always an offset with the "inner" grid. i have had a look at all the examples provided for inner grids and all have 1 problem or two. check my code:
this.onCellClicked = function(event, column, row)
{
var minusOffset = 0;
var ContractRow = false;
this.refresh();
awChildGrid.setContent('innercontent','');
awChildGrid.refresh();
var GetData = ["41", "A0048", "BHC598EC", "Toyota", "Stallion", "3 Door", "AHT32YF5000029470", "2Y9110544", ""],
];
myData2 = eval(GetData);
awChildGrid.setCellData(myData2);
awChildGrid.setRowCount(myData2.length);
awChildGrid.refresh();
var NumRows = myData2.length;
if (NumRows > 10) { NumRows = 10; }
/************** NOTE *************************/
custRowH = 48 + eval(awVehiclesListGrid.getRowHeight()) + (eval(awVehiclesListGrid.getRowHeight()) * NumRows) + 6;
actualRow = row;
if(expandedrow == true && lastRow==row)
{
ContractRow = true;
}
if(eval(awVehiclesListGrid.getSelectorText(row)) > eval(awVehiclesListGrid.getSelectorText(lastRow)))
{
minusOffset = custRowH - awVehiclesListGrid.getRowHeight();
if(expandedrow == false) { minusOffset = 0; }
}
ExpandRow(row);
lastRow=row;
var el = this.getCellTemplate(0, row).element();
GridHeight = this.getStyle('height');
GridHeight = GridHeight.substring(0, GridHeight.length - 2);
if(!ContractRow && this.getVirtualMode() == true)
{
if(((AW.getTop(el) - 24 - this.getHeaderHeight()) + custRowH) > GridHeight)
{
this.setScrollTop(row * this.getRowHeight());
}
}
var x = AW.getLeft(el) + 10;
var y = ((AW.getTop(el) - 3) - minusOffset) + el.offsetHeight;
awChildGrid.setStyle('height', custRowH-31 );
var ParentGridWidth = eval(this.element().offsetWidth) - 60;
awChildGrid.setControlPosition(x, y);
awChildGrid.setStyle('width', ParentGridWidth);
awChildGrid.setControlVisible(true);
alert(this.getVirtualMode());
if(this.getVirtualMode() == true)
{
this.setScrollBars("none");
this.getScrollTemplate().setEvent(AW.ie ? "onmousewheel" : "onDOMMouseScroll", "");
}
if(ContractRow)
{
this.setControlVisible(false);
if(this.getVirtualMode() == true)
{
this.setScrollBars("both");
}
}
this.refresh();
awChildGrid.refresh();
}
catch(Exception)
{
alert("error");
}
};
this.onScrollTopChanged = function(top)
{
top = this.getScrollTop();
if(this.getVirtualMode() === false)
{
if(LastScrollPosition != top)
{
LastScrollPosition = top;
try
{
var CurrentRow = this.getCurrentRow();
var el = this.getCellTemplate(0, CurrentRow).element();
var x = AW.getLeft(el) + 10;
var y = eval(el.getBoundingClientRect().top) + awChildGrid.getHeaderHeight();
this.raiseEvent("onScrollTopChanged");
}
catch(Exception)
{
alert("broken");
}
}
}
};
this.onCellClicked = function(event, column, row)
{
var minusOffset = 0;
var ContractRow = false;
this.refresh();
awChildGrid.setContent('innercontent','');
awChildGrid.refresh();
var GetData = ["41", "A0048", "BHC598EC", "Toyota", "Stallion", "3 Door", "AHT32YF5000029470", "2Y9110544", ""],
];
myData2 = eval(GetData);
awChildGrid.setCellData(myData2);
awChildGrid.setRowCount(myData2.length);
awChildGrid.refresh();
var NumRows = myData2.length;
if (NumRows > 10) { NumRows = 10; }
/************** NOTE *************************/
custRowH = 48 + eval(awVehiclesListGrid.getRowHeight()) + (eval(awVehiclesListGrid.getRowHeight()) * NumRows) + 6;
actualRow = row;
if(expandedrow == true && lastRow==row)
{
ContractRow = true;
}
if(eval(awVehiclesListGrid.getSelectorText(row)) > eval(awVehiclesListGrid.getSelectorText(lastRow)))
{
minusOffset = custRowH - awVehiclesListGrid.getRowHeight();
if(expandedrow == false) { minusOffset = 0; }
}
ExpandRow(row);
lastRow=row;
var el = this.getCellTemplate(0, row).element();
GridHeight = this.getStyle('height');
GridHeight = GridHeight.substring(0, GridHeight.length - 2);
if(!ContractRow && this.getVirtualMode() == true)
{
if(((AW.getTop(el) - 24 - this.getHeaderHeight()) + custRowH) > GridHeight)
{
this.setScrollTop(row * this.getRowHeight());
}
}
var x = AW.getLeft(el) + 10;
var y = ((AW.getTop(el) - 3) - minusOffset) + el.offsetHeight;
awChildGrid.setStyle('height', custRowH-31 );
var ParentGridWidth = eval(this.element().offsetWidth) - 60;
awChildGrid.setControlPosition(x, y);
awChildGrid.setStyle('width', ParentGridWidth);
awChildGrid.setControlVisible(true);
alert(this.getVirtualMode());
if(this.getVirtualMode() == true)
{
this.setScrollBars("none");
this.getScrollTemplate().setEvent(AW.ie ? "onmousewheel" : "onDOMMouseScroll", "");
}
if(ContractRow)
{
this.setControlVisible(false);
if(this.getVirtualMode() == true)
{
this.setScrollBars("both");
}
}
this.refresh();
awChildGrid.refresh();
}
catch(Exception)
{
alert("error");
}
};
this.onScrollTopChanged = function(top)
{
top = this.getScrollTop();
if(this.getVirtualMode() === false)
{
if(LastScrollPosition != top)
{
LastScrollPosition = top;
try
{
var CurrentRow = this.getCurrentRow();
var el = this.getCellTemplate(0, CurrentRow).element();
var x = AW.getLeft(el) + 10;
var y = eval(el.getBoundingClientRect().top) + awChildGrid.getHeaderHeight();
this.raiseEvent("onScrollTopChanged");
}
catch(Exception)
{
alert("broken");
}
}
}
};
jc
November 30,