User Guide
Creating Data Grids with cfgrid 153
Specifying the tree item in the URL
When a user clicks on a tree item to link to a URL the cftreeItemKey variable, which
identifies the selected value, is appended to the URL in the form:
http://myserver.com?cftreeitemkey =selected_value
Automatically passing the name of the selected tree item as part of the URL makes it
easy to implement a basic "drill down" application that displays additional
information based on the selection. For example, if the specified URL is another
CFML page, it can access the selected value as the variable
URL.cfteeitemkey.
You can disable this behavior by setting the
appendkey attribute in the cftree tag to
No.
Creating Data Grids with cfgrid
The cfgrid tag to creates a cfform grid control. A grid control resembles a
spreadsheet table and can contain data populated from a
cfquery or from other
sources of data. As with other
cfform tags, cfgrid offers a wide range of data
formatting options as well as the option of validating user selections with a
JavaScript validation script.
You can also do the following with
cfgrid:
• Sort data in the grid alphanumerically
• Update, insert, and delete data
• Display images in the grid
Users can sort the grid entries in ascending order by double-clicking any column
header. Double-clicking again sorts the grid in descending order. You can also add
sort buttons to the grid control.
When users select grid data and submit the form, ColdFusion passes the selection
information as form variables to the application page specified in the
cfform action
attribute.
Just as the cftree tag uses cftreeitem, cfgrid uses the cfgridcolumn tag. You can
define a wide range of row and column formatting options, as well as a column
name, data type, selection options, and so on. You use the
cfgridcolumn tag to
define individual columns in the grid or associate a query column with a grid
column.
The
cfgrid tag provides many attributes that control grid behavior and appearance.
This document can only cover the most important of these. For detailed information
on these attributes, see the
CFML Reference.