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

TreeGrid Specific Extensions

Lines Between Nodes

The user can enable/disable lines between TreeGrid nodes (disabled by default) by means of calling the following command:

treegrid.enableTreeGridLines(true);

Related sample:  TreeGrid lines

Math Formulas in TreeGrid

In addition to standard dhtmlxGrid math formulas, TreeGrid has the ability to calculate totals for children values:

treegrid.setColTypes("ed,ed,ed,ed,ed[=sum]");

It means that each parent element in the last column will contain the sum of cells in the child rows of the same column.

Related sample:  Math calculations

Statistic Counters in TreeGrid

TreeGrid provides additional set of built-in statistics counters (the default statistics counters work only for visible rows, and won't work correctly in case of the treegrid in which some rows can be hidden in closed branches). There are the following statistics counters available:

  • stat_tree_total - counts total of all values in a column;
  • stat_tree_total_leaf - counts total of all values in a column, but includes only the values on the last level of the tree;
  • stat_tree_multi_total - counts the total of column's multiplication;
  • stat_tree_multi_total_leaf - counts total of column's multiplication, but includes only the values on the last level of the tree;
  • stat_tree_max - counts the maximal value in a column;
  • stat_tree_max_leaf - counts the maximal value in a column, but includes only the values on the last level of the tree;
  • stat_tree_min - counts the minimal value in a column;
  • stat_tree_min_leaf - counts the minimal value in a column, but includes only the values on the last level of the tree;
  • stat_tree_average - counts the average value in a column;
  • stat_tree_average_leaf - counts the average value in a column, but includes only the values on the last level of the tree;
  • stat_tree_count - counts a real count of items in the TreeGrid;
  • stat_tree_count_leaf - counts a real count of items in the TreeGrid, but includes only the values on the last level of the tree.

Setting Drag Behavior

Drag-And-Drop behavior for TreeGrid can be set in the following way:

treegrid.setDragBehavior(mode);

It is possible to select one of the following modes:

  • child - the item is dropped as a child of the target item;
  • sibling - the item is dropped as a sibling of the target item; if drop occurs between the parent and the child elements, the item is moved to the parent level;
  • complex - the item is dropped as a sibling or a child depending on the position of the target item towards the landing; if drop occurs between the parent and the child elements, the item is moved to the parent level;
  • sibling-next - the item is dropped as a sibling of the target; if drop occurs between the parent and the child elements, the item is moved to the child level;
  • complex-next - the item is dropped as a sibling or a child depending on the position of the target item towards the landing; if drop occurs between the parent and the child elements, the item is moved to the child level.

Related sample:  Drag and Drop between Grids

Back to top