User Guide

Chapter 1: ColdFusion Tags 79
If the APPENDKEY attribute is set to No, then no grid values are appended to the URL.
The value of selection is determined by the value of the SELECTMODE attribute:
When SELECTMODE="Single", selection is the value of the column clicked.
When SELECTMODE="Row", selection is a comma-separated list of column
values in the clicked row, beginning with the value of the first cell in the selected
row.
When SELECTMODE="Column", selection is a comma-separated list of row values in
the clicked column, beginning with the value of the first cell in the selected column.
Note CFGRID incorporates a Java applet, so browsers must be Java-enabled for
CFGRID to work properly.
Example <!--- This example shows the CFGRID, CFGRIDCOLUMN, CFGRIDROW,
and CFGRIDUPDATE tags in action --->
<!--- use a query to show the useful qualities of CFGRID --->
<!--- If the gridEntered form field has been tripped,
perform the gridupdate on the table specified in the database.
Using the default value keyonly=yes allows us to change only
the information that differs from the previous grid --->
<CFIF IsDefined("form.gridEntered") is True>
<CFGRIDUPDATE GRID="FirstGrid" DATASOURCE="cfsnippets"
TABLENAME="CourseList" KEYONLY="Yes">
</CFIF>
<!--- query the database to fill up the grid --->
<CFQUERY NAME="GetCourses" DATASOURCE="cfsnippets">
SELECT Course_ID, Dept_ID, CorNumber,
CorName, CorLevel, CorDesc
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</CFQUERY>
<HTML>
<HEAD>
<TITLE>
CFGRID Example
</TITLE>
</HEAD>
<BODY>
<H3>CFGRID Example</H3>
<I>Try adding a course to the database, and then deleting it.</I>
<!--- call the CFFORM to allow us to use CFGRID controls --->
<CFFORM ACTION="cfgrid.cfm" METHOD="POST" ENABLECAB="Yes">
<!--- We include Course_ID in the CFGRID, but do not allow
for its selection or display --->