Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
78
CFML Language Reference 
Usage
You can populate a CFGRID with data from a 
CFQUERY
. If you do not specify any 
CFGRIDCOLUMN
 entries, a default set of columns is generated. Each column in the 
query is included in the default column list. In addition, a default header for each 
column is created by replacing any hyphen (-) or underscore (_) characters in the table 
column name with spaces. The first character and any character after a space is 
changed to uppercase; all other characters are lowercase.
Select mode and form variables
Grid data is submitted in a CFFORM as form variables, depending on the value of the 
SELECTMODE attribute as follows:
When SELECTMODE="Single", grid data is returned as 
grid_name.selectedname and the value of the selected cell.
When SELECTMODE="Column", grid data is returned as a comma-separated 
list of all the values for the selected column.
When SELECTMODE="Row", grid data is returned as grid_name.colum1_name 
and grid_name.column2_name and their respective values for the selected row.
When SELECTMODE="Browse", no selection data is returned.
Using SELECTMODE="Edit"
When SELECTMODE=“Edit ", one-dimensional arrays are used to store data about 
changes to the grid cells. For example, a one-dimensional array is used to store the 
type of edits made to grid cells:
gridname.RowStatus.Action [ value ]
Where gridname is the name of the CFGRID and action is U, I, or D for Update, Insert, 
and Delete, respectively. 
ColdFusion also maintains both the value of the edited cell and the original value in 
one-dimensional arrays. You can reference this data in ColdFusion expressions as 
follows:
gridname.colname[ value ]
gridname.original.colname[ value ]
Where gridname is the name of the CFGRID, colname is the name of the column, and 
value is the index position containing the grid data. 
Using the HREF attribute
When specifying a URL with grid items using the HREF attribute, the value of the 
SELECTMODE attribute determines whether the appended key value is limited to a 
single grid item or whether it extends to a grid column or row. When a user clicks on a 
linked grid item, a CFGRIDKEY variable is appended to the URL in the following form:
http://myserver.com?CFGRIDKEY=selection