Dynamic loading means loading the levels on request (on opening a node that has children). To make it work in dhtmlxTreeGrid the following requirements should be fulfilled:
treegrid.kidsXmlFile="pro_treeGrid_dynamic.php";
This routine will get the URL parameter's id that is the id of the row that was opened (in other words, id of the row that is the parent of the level that should be returned by the above-mentioned routine).
<row id="parent1" xmlkids="1">
<cell>...</cell>
...
JSON format:
{
rows:[
{id:"parent1",xmlkids:"1", data:["row A"]}
]
};
<rows parent="parent1">
<row id="child1" xmlkids="1">
<cell>...
...
Related sample: Dynamic loading (using PHP)
Smart parsing can increase the performance of the TreeGrid control when the user has lots of nodes and levels in it. Smart parsing can be enabled in the following way:
treegrid.enableSmartXMLParsing(true);
The following method is used for setting item's label in TreeGrid:
treegrid.setLabel(val); // new label value
It's simple to add a new row into dhtmlxTreeGrid with the help of the method addRow:
treegrid.addRow(new_id, text, ind);
The parameters of the method are responsible for the following:
Related sample: TreeGrid basic operations
The following methods should be used to expand/collapse a row in the TreeGrid:
treegrid.openItem(rowId);
treegrid.closeItem(rowId);
Back to top