DHTMLX Docs & Samples Explorer

Dynamical Loading in TreeGrid

Dynamical loading means loading levels on request (on opening a node that has children). To make it work in dhtmlxTreeGrid, the user should do the following:

  • When initializing the TreeGrid, specify the URL of server routine that returns the nested level:
        treegrid.kidsXmlFile="pro_treeGrid_dynamic.php";

This routine will get URL parameter id that is id of the row that was opened (in other words - id of the row that is parent to the level that should be returned by the above mentioned routine).

  • Initial TreeGrid XML (as well as XML returned by routine mentioned in the previous point) should have <row> tags with the attribute xmlkids=“1” (only rows that have child items):
    <row xmlkids="1"> 
        <cell>...</cell> 
        ...

JSON format:

   {
      rows:[
         {id:'1',xmlkids:'1', data:["row A"]}
      ]
   };
  • XML returned by routine specified in the first point should have the attribute parent=“xxx” in the top level tag <rows>:
    <rows parent='123'> 
        <row xmlkids="1"> 
            <cell>...
            ...