dhtmlxconnector:treegroupconnector [DHX documentation]

PHP Connector DHTMLX

TreeGroupConnector/TreeGridGroupConnector

Default connector for Tree and TreeGrid expects that data in DB is stored with child-parent key relation. But, in some cases, tree or treegrid need to be shown from plain data (by grouping it). Such task can be resolved with help of the TreeGroupConnector or TreeGridGroupConnector.

For example, a table 'products' grouping by category. As result, the top level are 'categories', the second level - 'products', related to the category.

//tree
require("./codebase/connector/tree_group_connector.php");
 
$tree = new TreeGroupConnector($res);
$tree->render_table("products2", "id", "product_name", "", "category");
 
//treeGrid
<code php>
require_once('../../codebase/treegridgroup_connector.php');
 
$treegrid = new TreeGridGroupConnector($res,"MySQL");
$treegrid->render_table("products2", "id", "product_name,scales,colour", "", "category");