User Guide
cfgridcolumn 203
Example
The following example lets you update certain fields of the CourseList table in the cfdocexamples
database. It uses
cfgridcolumn tags to structure the table.
<!--- If the gridEntered field exists, the form has been submitted.
Update the database. --->
<cfif IsDefined("form.gridEntered")>
<cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples"
tableName = "CourseList" keyOnly = "Yes">
</cfif>
<!--- Query the database to fill up the grid. --->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
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>You can update the Name, Level, and Description information for courses.</i>
<!--- The cfform tag must surround a cfgrid control. --->
<cfform action = "#CGI.SCRIPT_NAME#">
<cfgrid name = "FirstGrid" width = "500"
query = "GetCourses" colheaderbold="Yes"
font = "Tahoma" rowHeaders = "No"
selectColor = "Red" selectMode = "Edit" >
<!--- cfgridcolumn tags arrange the table and control the display. --->
<!--- Hide the primary key, required for update --->
<cfgridcolumn name = "Course_ID" display = "No">
<!--- select="No" does not seem to have any effect !!! --->
<cfgridcolumn name = "Dept_ID" header = "Department" Select="No"
width="75" textcolor="blue" bold="Yes">
LHour in am/pm (1-12).
N Minute in hour.
Examples:
N = 3
NN = 03
SSecond in minute.
Other text You can add other text into the pattern string to further format the string. You can
use punctuation, numbers, and all lowercase letters. You should avoid uppercase
letters because they may be interpreted as pattern letters.
Example:
EEEE, MMM. D, YYYY at H:NN A = Tuesday, Sept. 8, 2003 at 1:26 PM
Pattern letter Description