![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 156](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369156.webp)
130
Developing Web Applications with ColdFusion
4
QUERY="engquery"
4
QUERYASROOT="yes"
4
IMG="folder,document">
4
</CFTREE>
</CFFORM>
3.
Save the page and view it in your browser.
Code Review
Grouping output from a query
In a similar query, you may 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 Studio.
2.
Modify the page so that it appears as follows:
<!--- CFQUERY with an ORDER BY clause --->
<CFQUERY NAME="deptquery" DATASOURCE="CompanyInfo">
SELECT Department_ID, Fir ’ ’ + LastName
AS FullName
FROM EMPLOYEES
ORDER BY Department_ID
</CFQUERY>
Code
Description
<CFTREE NAME="tree1"
Create a tree and name it tree1.
REQUIRED="yes"
Specify that a user must select
an item in the tree.
HSCROLL="no"
Don’t allow horizontal scrolling.
VSCROLL="yes">
Allow vertical scrolling.
<CFTREEITEM VALUE=FullName
QUERY="engquery"
Create an item in the tree and
put the results of the query
named engquery in it.
QUERYASROOT="yes"
Specify the query name as the
root level of the tree control.
IMG="folder,document"
Use the images "folder" and
"document" that ship with
ColdFusion in the tree structure.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...