Creating a 3rd level subgrid in my grid

Hi i’m trying to make a 3rd level subgrid and get this error

Uncaught TypeError: Cannot read property ‘appendChild’ of null

The grid and second level works fine only the last I cant get any data

here’s my grid code:

[code]
var subGrid;
var subGridAtec;
myGrid = new dhtmlXGridObject(‘GRID’);
myGrid.setImagePath(“lib/dhtmlxSuite/dhtmlxGrid/codebase/imgs/”);
myGrid.setHeader(" , KIT, Descrição, Endereço Entrega, Carrinho, Linha, Takt Time Difusão, Takt Time MTL, Impressora, Imprimir Automático");//set column names
myGrid.attachHeader(["","#text_filter","#text_filter","#text_filter","#text_filter","#text_filter","#text_filter","#text_filter", “#select_filter”, “#select_filter”]);
myGrid.setInitWidths(“20,150,200,,150,150,70,70,90,90");//set column width in px
myGrid.setColSorting(“na,str,str,str,str,str,str,str,str,str”);//set sorting
myGrid.enableResizing(“false,true,true,true,true,true,true,true,true,true”);
myGrid.init();//initialize grid
myGrid.setSkin(“dhx_skyblue”);//set grid skin
myGrid.clearAndLoad(“index.php?r=CADASTROKIT/ViewGrid”, function()
{
processos–;
checaProcessos();
});
myGrid.attachEvent(“onSubGridCreated”, function(subGrid){
processos++;
$("#progressLoader").show();
subGrid.setHeader(" , Informações do kit ,#cspan, #cspan");
subGrid.attachHeader(" ,Código, Produto, Quantidade");
subGrid.setInitWidths("20,200,
,200”);
subGrid.init();
processos–;
checaProcessos();
return true;

subGrid.attachEvent("onSubGridLoaded", function(subGridAtec){
  processos++;
  $("#progressLoader").show();
  subGridAtec.setHeader(" , Componentes da Area Tecnologica ,  ");
  subGridAtec.attachHeader(" , Código Componente , Descrição Componente");
  subGridAtec.setInitWidths("20,200,*");
  subGridAtec.init();
  ready();
  processos--;
  checaProcessos();
  return true;
});  [/code]

and that’s is a bit of my xml for grid for 1 row

[code]
index.php?r=CADASTROKIT/ViewSubGrid&id=4a4

[/code]

that’s mine second level rows in xml

<row id="657">
<cell type="sub_row_grid">index.php?r=CADASTROKIT/ViewSubGridAtec&id=SE</cell>
<cell id="login" type="ro">
<![CDATA[ SE ]]>
</cell>
<cell id="login" type="ro">
<![CDATA[ Pesados51 ]]>
</cell>
<cell id="nome" type="ro">
<![CDATA[ ]]>
</cell>
</row>
<row id="657">
<cell type="sub_row_grid">index.php?r=CADASTROKIT/ViewSubGridAtec&id=SE</cell>
<cell id="login" type="ro">
<![CDATA[ SE ]]>
</cell>
<cell id="login" type="ro">
<![CDATA[ SEMI EIXO ]]>
</cell>
<cell id="nome" type="ro">
<![CDATA[ ]]>
</cell>
</row>

and the third level of rows of my grid where I get the error when click on + to load the xml data

[code]

[/code]

how it could be solved ? The + to open the row appears and when is clicked the error shows in console and dont show anything on grid
thanks in advance for the help

Please, try to “return false” from your onSubGridCreated events instead of “return true” and then call subgrid.load(url) right in that event.

like this:

[code] myGrid.attachEvent(“onSubGridCreated”, function(subGrid){
processos++;
$("#progressLoader").show();
subGrid.setHeader(" , Informações do kit ,#cspan, #cspan");
subGrid.attachHeader(" ,Código, Produto, Quantidade");
subGrid.setInitWidths(“20,200,*,200”);
subGrid.init();

subGrid.attachEvent("onSubGridLoaded", function(subGridAtec){
  processos++;
  $("#progressLoader").show();
  subGridAtec.setHeader("&nbsp;, Componentes da Area Tecnologica , &nbsp;");
  subGridAtec.attachHeader("&nbsp;, Código Componente , Descrição Componente");
  subGridAtec.setInitWidths("20,200,*");
  subGridAtec.init();

subGridAtec.load(url,function(){
subGridAtec.callEvent(“onGridReconstructed”,[]);
subGrid.setSizes();
myGrid.setSizes();
})
ready();
processos–;
checaProcessos();
return false;
});
subGrid.load(url,function(){
subGrid.callEvent(“onGridReconstructed”,[]);
myGrid.setSizes();
})
processos–;
checaProcessos();
return false;
})[/code]