Whatever message this page gives is out now! Go check it out!
autoExpand = "yes|no" name = "column name" bgColor = "web color|expression" bold = "yes|no" dataAlign = "left|right|center" display = "yes|no" font = "column font" fontSize = "size" header = "header" headerAlign = "left|right|center" headerBold = "yes|no" headerFont = "font name" headerFontSize = "size" headerIcon = "icon path" headerItalic = "yes|no" headerMenu = "yes|no" headerTextColor = "web color" href = "URL" hrefKey = "column name" italic = "yes|no" mask= "format mask" numberFormat = "format" select = "yes|no" target = "URL target" textColor = "web color|expression" type = "type" values = "comma-separated strings and/or numeric range" valuesDelimiter = "delimiter character" valuesDisplay = "comma-separated strings and/or numeric range" width = "column width"> |
Attribute | Req/Opt; formats | Default | Description | |
autoExpand | Optional;HTML | yes for first column and no for remaining columns | On a particular column, it lets you expand the specified column. Setting autoExpand="yes" for multiple columns results in error. Also, if the attribute display is set to no, then autoExpand cannot be yes; else, it results in error. | |
name | Required;all | Name of the grid column element. If the grid uses a query, this attribute must be the name of the query column that populates the grid column. | ||
bgColor | Optional;all | Color of background of grid column.
| ||
bold | Optional;all | As specified by cfgrid |
| |
dataAlign | Optional;applet, Flash, HTML | As specified by cfgrid | Column data alignment:
| |
display | Optional;all | yes |
| |
font | Optional;all | As specified by cfgrid | Font of data in column. | |
fontSize | Optional;all | As specified by cfgrid | Size of text in column. | |
header | Optional;all | yes | Text for the column header. Used only if the cfgrid colHeaders attribute is yes. The default value is yes. | |
headerAlign | Optional;applet | As specified by cfgrid | Column header text alignment:
| |
headerBold | Optional;HTML, applet | As specified by cfgrid |
| |
headerFont | Optional;HTML, applet | As specified by cfgrid | Font for the column header. | |
headerFontSize | Optional;HTML, applet | As specified by cfgrid | Size of text for the column header, in pixels. | |
headerIcon | Optional | Location of an image file to use as the icon for header column of the grid. | ||
{{headerMenu}}Added in ColdFusion 9.0.1 | Optional;HTML | no | Lets you turn on/off the header menu of the grid column. Header menu is the drop-down list that appears on grid header columns on mouse hover. The attribute is helpful when you have images for grid headers. | |
headerItalic | Optional;HTML, applet | As specified by cfgrid |
| |
headerTextColor | Optional;HTML, applet | Color of grid control column header text.
| ||
href | Optional;HTML, applet | URL or query column name that contains a URL to hyperlink each grid column with. | ||
hrefKey | Optional;HTML, applet | The query column to use for the value appended to the href URL of each column, instead of the column's value. | ||
italic | Optional;all | As specified by cfgrid |
| |
mask | Optional;Flash, HTML | A mask pattern that controls the character pattern that the form displays or allows users to input and sends to ColdFusion. For columns with the currency type attribute, the mask specifies the currency symbol. ColdFusion automatically inserts the character before the numeric value. For columns with text or numeric values, mask specifies the format to display or allow users to input, as follows:
| ||
numberFormat | Optional;Applet | Format for displaying numeric data in the grid. See the following table of numberFormat attribute mask characters. | ||
select | Optional;all | yes | Determines selection behavior if the cfgrid selectmode attribute value is column, edit, or single; ignored for row or browse values.
| |
target | Optional;HTML, Applet | Frame or standard HTML target in which to open link specified in href. | ||
textColor | Optional;Applet, Flash, HTML | Color of grid element text in column as a hexadecimal number or text name. To enter a hexadecimal value, use the form "##xxxxxx", where x = 0-9 or A-F; use two number signs or none. Limitations: In HTML format, must specify a valid HTML color. In Applet format, must be one of the following:
| ||
type | Optional;all | You can specify the following values in all formats:
| ||
values | Optional;HTML, applet | Formats cells in column as drop-down list boxes; specify items in drop-down list, for example:
| ||
valuesDelimiter | Optional;HTML, applet | , (comma) | Delimiter in values and valuesDisplay attributes. | |
valuesDisplay | Optional;HTML, applet | Maps elements in the values attribute to string to display in the drop-down list. Delimited strings and/or numeric ranges. | ||
width | Optional;all | Column head width | Column width, in pixels. |
Before | After |
Y | N |
T | F |
1 | 0 |
true (for static grids) | false (for static grids) |
true (for dynamic grids) | NO (for dynamic grids) |
For non-boolean or null | Y |
Character | Meaning |
_ | (Underscore) Digit placeholder. |
9 | Digit placeholder. |
. | (Period) Location of mandatory decimal point. |
0 | Located to left or right of mandatory decimal point; pads with zeros. |
( ) | Puts parentheses around mask if number is less than 0. |
+ | Puts plus sign before positive numbers, minus sign before negative numbers. |
- | Puts space before positive numbers, minus sign before negative numbers. |
, | (Comma) Separates every third decimal-place with a comma. |
L,C | Left-justify or center-justify number within width of mask column. First character of mask must be L or C. Default: right-justified. |
$ | Puts dollar sign before formatted number. Must be the first character of mask. |
^ | (Caret) Separates left from right formatting. |
Pattern letter | Description |
Y | Year. If the number of pattern letters is two, the year is truncated to two digits; otherwise, it appears as four digits. The year can be zero-padded, as the third example shows in the following set of examples: Examples:YY = 03YYYY = 2003YYYYY = 02003 |
M | Month in year. The format depends on the following criteria:
|
D | Day in month. Examples:D=4DD=04DD=10 |
E | Day in week. The format depends on the following criteria:
|
A | AM/PM indicator. |
J | Hour in day (0-23). |
H | Hour in day (1-24). |
K | Hour in am/pm (0-11). |
L | Hour in am/pm (1-12). |
N | Minute in hour. Examples:N = 3NN = 03 |
S | Second 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. Avoid upper case 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 |
<!--- 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">
<cfgridcolumn name = "CorNumber" header = "Course ##" Select="No" width="65">
<cfgridcolumn name = "CorName" header = "Name" width="125">
<cfgridcolumn name = "CorLevel" header = "Level" width="85">
<cfgridcolumn name = "CorDesc" header = "Description" width="125">
</cfgrid>
<br>
<cfinput type="submit" name="gridEntered">
</cfform>
</body>
</html>