On onclik the row(containing a subgrid ) expands and I get t

i do this: onclick=‘mygrid.cells(mygrid.getSelectedRowId(),0).open(); someFunction();‘

somefunction contains:

if (mygrid.getSelectedRowId())
{
if(mygrid.cells(mygrid.getSelectedRowId(),mygrid.getColumnsNum()-1).getValue()==’’ || mygrid.cells(mygrid.getSelectedRowId(),mygrid.getColumnsNum()-1).getValue()==‘i’ )
{
//new route not yet inserted
alert(’<?=JS_INSERT_NEW_ROUTE_BEFORE_ADDING_NEW_STOPS?>’);
return;
}
else
{
var sub=mygrid.cells(mygrid.getSelectedRowId(),0).getSubGrid();
if (sub.getRowsNum()>=2 && sub.cells(sub.getRowId(sub.getRowsNum()-2),0).getValue()==’’)
{
alert(’<?=JS_VALIDATION_STOP_NEW?>’);
return;
}
else
{
sub.addRow(sub.getRowsNum()+1,’’,sub.getRowsNum()+1);
return;
}
}

}
else
{
alert(’<?=JS_SELECT_ROUTE?>’);
return;
}

On onclik the row(containing a subgrid ) expands and I get this error: his.hdr.rows[0] has no properties
[Break on this error] for(var i=0;i<this.hdr.rows[0].cells.length;i++){ ,afterward

if I put an alert(mygrid.getSelectedRowId()); at the begining of the function the error doesn’t appear anymore;


When you call .open for subgrid first time, it loads data from server , and this loading is async. Which means the code in someFunction executed before subgrid fully loaded


You need to use onXLE event of subgrid or onSubGridLoaded event of master grid to catch moment when data in subgrid loaded and you can poll info from it.