Expand all levels of TreeGrid data

I have a TreeGrid with two levels of data . While loading the TreeGrid I want to have all the levels of grid to be expanded . I tried using the function (mygrid.openItem(id)) to expand all the tree levels but unfortunately only the last row of the tree grid gets expanded while loading the grid.

mygrid.loadXML("01_basic_connector.php", function() { mygrid.forEachRow(function(id) { mygrid.openItem(id); }); });

but if i put some javascript:alert after the openitem(id) all the levels of treegrid got expanded one by one with alert message displaying the id of each row.

mygrid.loadXML("01_basic_connector.php", function() { mygrid.forEachRow(function(id) { mygrid.openItem(id); javascript:alert(id); }); });

I am using TreeGridMultitableConnector for loading data to grid. Is there any way to have the all the levels of tree data expanded while loading/after loading the TreeGrid.
Please help me out with this issue.


pls provide your dynamical loading xml to reconstruct the problem

I am using following code for loading the grid.


$treegrid = new TreeGridMultitableConnector($res);

$level = $treegrid->get_level();

switch ($level) {
case 0:
$treegrid->render_sql(“SELECT * FROM sample_1”,“id”,“general_type,status,site,location”,"","");
case 1:
$treegrid->render_sql(“SELECT * FROM sample_2”, “id1”, “general_type,status,site,location”, “”, “id”);

Hi, sorry for the delay in answering.
Answer is available here: