faisalmohi
asked on
cftree need sub menu
Dear Expert,
how to get sub menu under each node
<cfquery name="getCourses" datasource="tree">
SELECT main.id_name, sub.id, sub.description
FROM sub INNER JOIN main ON sub.parent_id = main.id;
</cfquery>
in mdb file in "sub" table i assing parent id of sub table's id so each node under i can get sub node , also i need another sub node under this subnote , i mean dynamic and unlimited
<cfform name="studentForm" format="flash" width="1000" height="1000">
<cftree name="courseTree" width="985" height="950" font="Arabic Transparent" fontsize="12.5">
<cftreeitem
query="getCourses"
value="id_name,id"
display="id_name,descripti on" queryasroot="NO" expand="no">
</cftree>
</cfform>
cfdocexamples.mdb
untitled.JPG
how to get sub menu under each node
<cfquery name="getCourses" datasource="tree">
SELECT main.id_name, sub.id, sub.description
FROM sub INNER JOIN main ON sub.parent_id = main.id;
</cfquery>
in mdb file in "sub" table i assing parent id of sub table's id so each node under i can get sub node , also i need another sub node under this subnote , i mean dynamic and unlimited
<cfform name="studentForm" format="flash" width="1000" height="1000">
<cftree name="courseTree" width="985" height="950" font="Arabic Transparent" fontsize="12.5">
<cftreeitem
query="getCourses"
value="id_name,id"
display="id_name,descripti
</cftree>
</cfform>
cfdocexamples.mdb
untitled.JPG
In loop, you would have 2 do 2 loops and 2 queries, the first one will get the , and the second one will get the sub-menu's
something like this
something like this
<cfquery name="getCourses" datasource="tree">
SELECT main.id_name, main.id
FROM sub
</cfquery
<cfform name="studentForm" format="flash" width="1000" height="1000">
<cftree name="courseTree" width="985" height="950" font="Arabic Transparent" fontsize="12.5">
<cfloop query="getCourses">
<cftreeitem value="#getCourses.id_name#">
<cfquery name="getSubMenu" datasource="tree">
SELECT sub.id, sub.description
FROM sub where sub.parent_id = #id#
</cfquery>
<cfif getSubMenu.id NEQ ''>
<cfloop query="getSubMenu">
<cftreeitem value="#getSubMenu.description#"
parent="#getCourses.id_name#">
</cfloop>
</cfif>
</cfloop>
</cftree>
</cfform>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
say you have a sub-tree under Divisions, so you would have
<cftreeitem value="Divisions">
<cftreeitem value="Development"
parent="Divisions" img="folder">
so the Development would be under Divisions, specify the parent in there...
here is an example
Open in new window