Sub grid initialization


Hi,



I am working on a grid with a subgird. But when I tried to access the subgrid using



var sub=mygrid.cellById(rowId,cellInd).getSubGrid();



it says that



mygrid.cellById(rowId, cellInd).getSubGrid is not a function



i571.photobucket.com/albums/ss15 … shot73.jpg



here is my included files



    

            

        



    





Did I miss something?



Thanks



Florante



Please make sure if you are calling var sub=mygrid.cellById(rowId,cellInd).getSubGrid(); after sub grid was already initialized. If you need catch moment of sub grid initialization you can use “onSubGridCreated” event. This event occurs when the creation of a sub-grid was initiated. Event pass the following parameters:
* sub - sub-grid object;
* rId - id of the related row;
* rInd - index of the related row.
You can use this event to change sub grid loading source:
grid.attachEvent(“onSubGridCreated”,function(sub,id,ind,value){
//sub - subgrid object
//value - value from XML for related cell
sub.load(url);
return false; //block default logic });




I called up the function on onEditCell



mygrid.attachEvent(“onEditCell”,doOnCellEdit);



 



which is declared after the call to init



  mygrid.init(); 
  mygrid.attachEvent(“onEditCell”,doOnCellEdit);
  mygrid.loadXML(“grid1.xml”);



So I bellieved that mygrid is already iniitallized when the onEditCell event fired up.



 



Thanks



 



Florante