Connectors will work only if the dynamic loading mode on the client side is enabled (use the setXMLAutoLoading() method for Tree, the enablePaging() or enableSmartRendering() methods for TreeGrid).
In many cases, Tree or TreeGrid need to be built from multiple tables (each table represents a separate level of Tree/TreeGrid). For this purpose TreeMultitableConnector/TreeGridMultitableConnector (instead of TreeConnector/TreeGridConector) should be used .
require("../../codebase/treemultitable_connector.php");
$tree = new TreeMultitableConnector($res);
$tree->setMaxLevel(3);
$level = $tree->get_level();
switch ($level) {
case 0:
$tree->render_table("projects2","project_id","project_name","","");
break;
case 1:
$tree->render_sql(
"SELECT teams2.team_id,teams2.team_name,project_team2.project_id
FROM teams2 INNER JOIN project_team2 ON teams2.team_id=project_team2.team_id",
"team_id","team_name","","pro_id");
break;
case 2:
$tree->render_table("developers2","developer_id","developer_name","",
"developer_team");
break;
case 3:
$tree->render_table("phones2", "phone_id", "phone", "", "phone_developer");
break;
}
require("../../codebase/treegridmultitable_connector.php");
$treegrid = new TreeGridMultitableConnector($res);
$treegrid->setMaxLevel(3);
$level = $treegrid->get_level();
...
Back to top