>- see footer for list info -<
First thing I noticed is that you have parent set to Categories in all the
tree items.
I've just used this for the first time too and here's what I have:
<cfform format="FLASH" width="550" height="650">
<cftree name="nodes" width="500" height="600">
<cfoutput query="allNodes" group="SiteID">
<cftreeitem value="SITEID_#allNodes.SiteID#"
display="#allNodes.Site#"
parent="nodes">
<cfoutput group="ProcessID">
<cftreeitem
value="PROCESSID_#allNodes.ProcessID#"
display="#allNodes.Process#" parent="SITEID_#allNodes.SiteID#">
<cfoutput group="FormID">
<cftreeitem
value="FORMID_#allNodes.FormID#" display="#allNodes.Form#"
parent="PROCESSID_#allNodes.ProcessID#">
<cfoutput group="FieldID">
<cftreeitem
value="FIELDID_#allNodes.FieldID#"
display="#allNodes.Label##ShareIDLabel#" parent="FORMID_#allNodes.FormID#">
<cfoutput group="SubFieldID">
<cftreeitem
value="SUBFIELDID_#allNodes.SubFieldID#"
display="#allNodes.SubLabel#" parent="FIELDID_#allNodes.FieldID#">
</cfoutput>
</cfoutput>
</cfoutput>
</cfoutput>
</cfoutput>
</cftree>
</cfform>
Hope it's of some help.
Adrian
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Paul Swingewood
Sent: 02 April 2007 17:07
To: [email protected]
Subject: [CF-Dev] cftree
>- see footer for list info -<
Can anyone help me with tis please. I have not used cftree before
I need a site map which will show all products with a sub category of a
category.
I want to show just the categories then expand to sub categories then expand
to products (If that makes sense...)
Like this ...
<Category (+)>Lathes
<Sub Category(+)>Chucks
<Product> 4 Jaw Chuck
and so on.....
I have this code The first bit proves that my queries are working ok ...
The next bit is my attempt at cftree. The problem is I don't get the (+)
'expand' for each level ...
<!--- Get the categories --->
<CFQUERY NAME="GetCategories" DATASOURCE="#application.dsn#">
SELECT CategoryID, CategoryName, CategoryImage
FROM tblCategories
</CFQUERY>
<cfoutput query="GetCategories">
Category Name - #CategoryName# <p>
<!--- Get the subcategories for this category --->
<CFQUERY NAME="GetSubCategories" DATASOURCE="#application.dsn#">
SELECT DISTINCT tblProducts.FKCategoryID,
tblProducts.FKSubcatID,
tblSubCategories.PKSubcatID,
tblSubCategories.SubcategoryName
FROM tblProducts
INNER JOIN tblSubCategories ON tblProducts.FKSubcatID =
tblSubCategories.PKSubcatID
WHERE (tblProducts.FKCategoryID =
#GetCategories.CategoryID#)
</CFQUERY>
<cfloop query="GetSubCategories">
SubCategory Name - #GetSubCategories.SubCategoryName#<p>
<!--- Now get the products for this subcategory --->
<CFQUERY NAME="GetProducts" DATASOURCE="#application.dsn#">
SELECT ProductName, FKSubcatID
FROM ValeEngineering.tblProducts
WHERE (FKSubcatID = #GetSubCategories.PKSubcatID#)
</CFQUERY>
<cfloop query="GetProducts">
Product Name - #GetProducts.ProductName#<br>
</cfloop>
<p>
</cfloop>
</cfoutput>
<!--- Display the tree. The cftree tag must be in a cfform. --->
<cfform action="action.cfm" preservedata="Yes" format="Flash">
<cftree name = "Menu" height = "400" width = "400"
font = "Arial Narrow" italic="yes" highlighthref="No" HScroll="no"
VScroll="no"
completepath="no" lookandfeel="windows" border="No" required="yes">
<!--- cfoutput tag with a group attribute loops over the departments.
--->
<cfoutput query = "GetCategories">
<cftreeitem value="#CategoryName#" parent="Categories"
expand="yes">
<CFQUERY NAME="GetSubCategories"
DATASOURCE="#application.dsn#">
SELECT DISTINCT tblProducts.FKCategoryID,
tblProducts.FKSubcatID,
tblSubCategories.PKSubcatID,
tblSubCategories.SubcategoryName
FROM tblProducts
INNER JOIN tblSubCategories ON
tblProducts.FKSubcatID =
tblSubCategories.PKSubcatID
WHERE (tblProducts.FKCategoryID =
#GetCategories.CategoryID#)
</CFQUERY>
<cfloop query="GetSubCategories">
<cftreeitem
value="#GetSubCategories.SubCategoryName#"
parent="Categories" expand="false">
<!--- Now get the products for this subcategory
--->
<CFQUERY NAME="GetProducts"
DATASOURCE="#application.dsn#">
SELECT ProductName, FKSubcatID
FROM ValeEngineering.tblProducts
WHERE (FKSubcatID =
#GetSubCategories.PKSubcatID#)
</CFQUERY>
<cfloop query="GetProducts">
<cftreeitem value="#GetProducts.ProductName#"
parent="Categories"
expand="false">
</cfloop>
<p>
</cfloop>
</cfoutput>
</cftree>
<cfinput type="Submit" name="submitit" value="Submit" width="100">
</cfform>
Any Ideas ....?
Regards - Paul
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<