DHTMLX Docs & Samples Explorer

TreeGrid Initialization

Script initialization of the treegrid is the same as for the grid. All the user should do is to decide what column should have tree structure and use “tree” eXcell for it.

XML structure should be as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <rows parent="h0"> 
        <userdata name="gud1"> 
            userdata value 1
        </userdata> 
        <row id="h523" selected="1" call="1" xmlkids="1"> 
            <userdata name="hondaUD"> 
                userdata value for honda
            </userdata> 
            <cell image="folder.gif">Honda</cell> 
            <cell>...</cell> 
            <cell>...</cell> 
        </row>
    </rows>

All XML tags and attributes are same as for dhtmlxGrid. The difference is in the following:

  • <rows> element can have the following attribute with treeGrid:
    • parent - (for dynamical loading) id of the row that is parent for the items under current rows;
  • <row> has the following TreeGrid specific attributes:
    • xmlkids - (for dynamical loading) this row has/doesn't have child rows;
    • open - specifies if a row is expanded (for TreeGrid);
    • style - specifies css style for the current row.
  • <cell> element also possesses TreeGrid specific parameter:
    • image - optional (default is leaf.gif) for a tree column; image name to use as tree node icon.