Check documentation for the latest version of dhtmlxSuite TreeGrid Specific API DHTMLX Docs

TreeGrid Specific API

Built-in Iterator

This way of TreeGrid iteration has the following characteristics:

  • the used parameter - row ID;
  • the order of iteration is not equal to the current rows order in the grid (basically, it is equal to the order of rows' adding into the grid, but it can be inconsistent);
  • in case of paging or smart rendering mode, all rows being parsed at the current moment will be affected;
  • in case of applied filtering, all rows in the grid (including the filtered out ones) will be included into iteration;
  • in case of TreeGird, all rows will be processed, including those in the closed branches.
treegrid.forEachRow(function(id){ //function that gets row's id as an incoming argument
//here id - row ID

You can implement a loop for the children of the specified row in TreeGrid as:

// - id of child row
// - parent id

where parent_id - id of the rows for which the functionality will be executed.

Cookies Manipulation

To interact with cookies in case of TreeGrid a user can apply the following methods :

treegrid.saveOpenStates(name,cookie_param); // store open state of TreeGrid in cookies
treegrid.loadOpenStates(name,cookie_param); // load open state of TreeGrid from cookies

The parameters the user should indicate are:

  • name - optional, cookie name;
  • cookie_param - additional parameters added to cookie.

Events Handling

The TreeGrid extension uses all Grid's events, but there are two additional ones. The following purely TreeGrid events are available:

Opening Events

  • onOpenStart Event - fires after an item in the tree has got the command to open/close, but before this item has opened/closed; it also fires for unclosable nodes and nodes without open/close functionality - in that case the result of the function will be ignored;
  • onOpenEnd Event - fires after an item in the tree has got the command to open/close and the related change in the structure has been processed (that includes data loading in case of TreeGrid in dynamic loading mode).
Back to top