![MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual Download Page 168](http://html1.mh-extra.com/html/macromedia/coldfusion-5-developing/coldfusion-5-developing_develop-manual_3293641168.webp)
148
Chapter 9 Building Dynamic Forms
Grouping output from a query
In a query that you display using a
cftree
control, you might want to organize your
employees by the department. In this case, you separate column names with
commas in the
cftreeitem
value
attribute.
To organize the tree based on ordered results of a query:
1
Open a new file named
tree2.cfm
in ColdFusion Studio.
2
Modify the page so that it appears as follows:
<!--- CFQUERY with an ORDER BY clause --->
<cfquery name="deptquery" datasource="CompanyInfo">
SELECT Dept_ID, Fir ’ ’ + LastName
AS FullName
FROM Employee
ORDER BY Dept_ID
</cfquery>
<!--- Build the tree control --->
<cfform name="form1" action="submit.cfm"
method="Post">
<cftree name="tree1"
hscroll="No"
border="Yes"
height="350"
required="Yes">
<cftreeitem value="Dept_ID, FullName"
query="deptquery"
queryasroot="Dept_ID"
img="cd,folder">
</cftree>
<br>
<br><input type="Submit" value="Submit">
</cfform>
3
Save the page and view it in your browser.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...