Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by andreea on Aug 18, 2008 06:35
open dhtmlx forum
Error for a treegrid with grid children

I obtain the subgrid :
var sub=mygrid.cells(mygrid.getSelectedRowId(),0).getSubGrid();
but when I try to do something afterwards, with the subgrid I can't .

For example:
alert(sub.getRowsNum()); returns 0


but if i do this:

alert("lalala");alert(sub.getRowsNum()); After lalala alert, I get the correct number of rows for the subgrid.
Answer posted by Support on Aug 18, 2008 07:09
The problem may be caused by the async. way of data loading in grid.
If you access subgrid exactly after opening, it may still be in data loading stage, so there is no configuration or data yet, and related command will not work. ( in case of alert - you create some delay, which is enough to load data in subgrid ) 

It possible to run something similar to next

var sub=mygrid.cells(mygrid.getSelectedRowId(),0).getSubGrid();
sub.attachEvent("onXLE",function(){
     alert(this.getRowsNum()) 
});

or use onSubGridLoaded event, which fire when data loaded in subgrid