Check documentation for the latest version of dhtmlxSuite TreeMultitableConnector and TreeGridMultitableConnector DHTMLX Docs

TreeMultitableConnector and TreeGridMultitableConnector

Connectors will work only if dynamic loading mode on client-side is enabled.

In many cases, tree or treegrid need to be built from multiple tables (each table represent separate level of tree/treegrid). For this purpose should be used TreeMultitableConnector/TreeGridMultitableConnector (instead of TreeConnector/TreeGridConector).

Tree

<cfinclude template="../config.cfm">
<cfset tree = createObject("component","dhtmlXConnectors.TreeMultiTableConnector").init("#datasource#","MySQL")>
<cfset tree.setMaxLevel(3)>
<cfset level = tree.get_level()>
<cfswitch expression="#level#">
    <cfcase value="0">
        <cfset tree.render_table("projects2", "project_id", "project_name, project_dsc", "", "")>
    </cfcase>
    <cfcase value="1">
        <cfset 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", "", "project_id")>
    </cfcase>
    <cfcase value="2">  
        <cfset tree.render_table("developers2", "developer_id", "developer_name,developer_email", "", "developer_team")>
    </cfcase>
    <cfcase value="3">  
        <cfset tree.render_table("phones2", "phone_id", "phone,phone_type", "", "phone_developer")>
    </cfcase>
</cfswitch>

connector/php/multitable_tree.png

TreeGrid

<cfinclude template="../config.cfm">
<cfset tree = createObject("component","dhtmlXConnectors.TreeGridMultitableConnector").init("#datasource#","MySQL")>
<cfset tree.setMaxLevel(3)>
<cfset level = tree.get_level()>
<cfswitch expression="#level#">
    <cfcase value="0">
        <cfset tree.render_table("projects2", "project_id", "project_name, project_dsc", "", "")>
    </cfcase>
    <cfcase value="1">
        <cfset 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", "", "project_id")>
    </cfcase>
    <cfcase value="2">  
        <cfset tree.render_table("developers2", "developer_id", "developer_name,developer_email", "", "developer_team")>
    </cfcase>
    <cfcase value="3">  
        <cfset tree.render_table("phones2", "phone_id", "phone,phone_type", "", "phone_developer")>
    </cfcase>
</cfswitch>

connector/php/treegrid_multitable.png

Back to top