:: Forum >>
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");
}
}
}
};
jc
Monday, November 30, 2009
jc
As far as I know, it's not possible to "embbed" a grid into another , not sure if it is beacuse scroll event or scrolling/row height calculations conficts, but all my tests failed.
I just found one way to do it, but could involve a possible license invalidation, so need Alex's confirmation before suggest it.
Anyway , you can try with a pop-up grid that simulates same effect, but complicate things some/lot.
HTH
Carlos
Monday, November 30, 2009
> i am trying to create a grid inside another grid
Why?
Anthony
Monday, November 30, 2009
Anthony, i have a grid (parentgrid) with data (motor vehicles). on a click of row / cell in that grid, i want it to open another grid (childgrid) with info for that particular vehicle (given registration number). i am getting the data via ajax. getting the info is not a problem.
to carlos, while we wait for alex, do u have further info on the pop-up grid. perhaps, it might be a way to go.
jc
Tuesday, December 1, 2009
Carlos
Tuesday, December 1, 2009
> i want it to open another grid (childgrid) with info for that particular vehicle (given registration number)
Are you sure you really need a grid to display this info? I can't see how it could be more than one row. Perhaps just pop up a div as an info box or populate something outside the grid for each row click.
Anthony
Tuesday, December 1, 2009
anthony, in the application that i am working on, it is different rows in length (some upto 15). i want the grid to rhyme with the theme that i hav for the app.
thankx for the info carlo, i'm going through it and will comment later. but i note all examples given are for ui.grid. they behave differently when applied to grid.extended
jc
Wednesday, December 2, 2009
This topic is archived.
Back to support forum
Forum search