dhtmlxconnector:component-specific_how-tos_tree_treegrid [DHX documentation]

PHP Connector DHTMLX

Component-specific how-tos (tree/treegrid)

How can I load data from multiple tables?

Using TreeMultitableConnector/TreeGridMultitableConnector instead of TreeConnector/TreeGridConector you can load data from multiple tables.

require("../../codebase/treemultitable_connector.php");
 
$tree = new TreeMultitableConnector($res);
$tree->setMaxLevel(3);
$level = $tree->get_level();

For more details, see 'TreeMultitableConnector/TreeGridMultitableConnector' guide.

How can I load data from table that doesn't contain relation field?

Using TreeGroupConnector/TreeGridGroupConnector instead of TreeConnector/TreeGridConector you can load data from table that doesn't contain relation field.

require("./codebase/connector/tree_group_connector.php");
 
$tree = new TreeGroupConnector($res);
$tree->render_table("products2", "id", "product_name", "", "category");

For more details, see 'TreeGroupConnector/TreeGridGroupConnector' guide.

How can I mark an item as a leaf or branch of tree?

In beforeRender event handler you are allowed to mark an item as a leaf or branch. For this purpose, you should use set_kids() method. As input parameter true or false must be specified. true marks an item as a branch, false - as a leaf.

$item->set_kids(false);

For more details see 'tree/treeGrid specific' chapter in 'Dynamic loading' guide.