In a query that you display using a cftree control, you might want to organize your employees by department. In this case, you separate column names with commas in the cftreeitem value attribute.
Organize the tree based on ordered results of a query
The following table describes the highlighted code and its function
:
Code |
Description |
---|---|
ORDER BY Dept_ID |
Orders the query results by department. |
<cftreeitem value="Dept_ID,FullName" |
Populates the tree with the department ID, and under each department, the full name for each employee in the department. |
queryasroot="Dept_ID" |
Labels the root "Dept_ID". |
img="computer,folder,document" imgopen="computer,folder" |
Uses the ColdFusion supplied computer image for the root level, folder image for the department IDs, and document for the names, independent of whether any level is expanded (open) or collapsed. The imgopen attribute has only two items, because the employee names can never be open. |
The cftreeitem comma-separated value, img, and imgopen attributes correspond to the tree level structure. In applet format, if you omit the img attribute, ColdFusion uses the folder image for all levels in the tree; if you omit the imgopen attribute, ColdFusion uses the folder image for all expanded levels in the tree. Flash format ignores the img and imgopen attributes and always uses folders for levels with children and documents for nodes without children.