DHTMLX Docs & Samples Explorer

Group connector for tree and TreeGrid

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 done with help of the TreeGroupConnector or TreeGridGroupConnector

Loads data from table products , grouping by category. As result top level - will be categories, second level - products, related to the category.

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

similar can be done to treegrid as

	require_once('../../codebase/treegridgroup_connector.php');
 
	$treegrid = new TreeGridGroupConnector($res,"MySQL");
	$treegrid->render_table("products2", "id", "product_name,scales,colour", "", "category");