Access to grandparent of subgrid

I have mutliple subgrids on my page and I am trying to access the grandparent of the subgrid when the subgrid is either being collapsed to expanded. To do this I am adding code to function dhtmlXGridObject.prototype._expandMonolite=function(n,show,hide) on line 72 in codebase/excells/dhtmlxgrid_excell_sub_row.js.



Am I correct in thinking that this original code in the function gets the parent grid object of the subgrid?



dhtmlXGridObject.prototype._expandMonolite=function(n,show,hide){

    var td=this.parentNode;

    var row=td.parentNode;

    var that=row.grid;



}



If so, shouldn’t this access the grandparent grid object?:



// Grand parent grid

var td=that.parentNode;

var row=td.parentNode;

var grandparent=row.grid;





When I try this, I keep getting errors that grandparent has no properties.



Once I get access to the grandparent, I want to call the function grandparent.callEvent(“onGridReconstructed”,[]); I am able to do this successfully to the parent ( the ‘that’ variable). I am calling this function to the grandparents because I need to correctly resize the grandparent so I can fully see all its children grids. I am not using the new dhtmlxGrid 2.0 but the previous version. Thanks!

Each subgrid has reference to its parent as
var parent = subgrid.parentGrid;

You can try to code similar to next , to the end of _expandMonolite method

if ( that.parentGrid) that.parentGrid.callEvent(“onGridReconstructed”,[])

It must be enough to force view updating for any upper levels of grids

Thank you for responding.  But when I used the object parentGrid on my reference to the subgrid I get the that.parentGrid has no properties error again.  I even checked to see if I get the same error when I try to access the parentGrid object using this.parentGrid, and I do.  I am still doing all this within the scope of the expandMonolite method.  What am I doing wrong? Is the parentGrid object only available in the new 2.0 version perhaps?  Does the ‘this’ variable reference in the function do in fact reference the subgrid? Thanks!