Used with the cfgrid tag in a cfform. Use this tag to specify column data in a cfgrid
control. The font and alignment attributes used in cfgridcolumn
override global font or alignment settings defined in cfgrid
.
<cfgridcolumn name = "column_name" header = "header" width = "column_width" font = "column_font" fontSize = "size" italic = "Yes" or "No" bold = "Yes" or "No" textColor = "web color" or "expression" bgColor = "web color" or "expression" href = "URL" hrefKey = "column_name" target = "URL_target" select = "Yes" or "No" display = "Yes" or "No" type = "type" headerFont = "font_name" headerFontSize = "size" headerItalic = "Yes" or "No" headerBold = "Yes" or "No" headerTextColor = "web color" dataAlign = "position" headerAlign = "position" numberFormat = "format" values = "Comma separated strings and/or numeric range" valuesDisplay = "Comma separated strings and/or numeric range" valuesDelimiter = "delimiter character">
cfapplet,
cfform, cfgrid tags,
cfinput,
cfselect,
cfslider,
cftextinput,
cftree
New in ColdFusion MX: if select = "no"
, a user cannot select and edit the cell data, regardless of the cfgrid selectmode
attribute value. When clicked, the cell border (and, depending on the selectColor
value, the cell background) changes color, but the cell data cannot be edited.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
name |
Required |
|
Name of grid column element. If grid uses a query, column name must specify name of a query column. |
header |
Optional |
Yes |
Column header text. Used only if cfgrid colHeaders = "Yes" . |
width |
Optional; see description |
Column head width |
Column width, in pixels. |
font |
Optional |
As specified by cfgrid |
Font of data in column. |
fontSize |
Optional |
As specified by cfgrid |
Size of text in column. |
italic |
Optional |
As specified by cfgrid |
|
bold |
Optional |
As specified by cfgrid |
|
textColor |
Optional |
|
Color of grid element text in column, or an expression to manipulate color; hex or text. To enter hex value, use the form "##xxxxxx", where x = 0-9 or A-F; use two pound signs or none. You can enter an expression; for example: textColor= "(C2 LT 0 ? red : pink)" This means: If value in Column 2 is less than 0, display value in red; otherwise, display value in pink. See "Using expressions in textColor and bgColor attributes".
|
bgColor |
Optional |
|
Color of background of grid column, or an expression to manipulate color. See "Using expressions in textColor and bgColor attributes".
|
href |
Optional |
|
URL o r query column name that contains a URL to hyperlink each grid column with. |
hrefKey |
Optional |
|
The query column to use for the value appended to the href URL of each column, instead of the column's value. |
target |
Optional |
|
Frame in which to open link specified in href . |
select |
Optional |
|
|
display |
Optional |
Yes |
|
type |
Optional |
|
|
headerFont |
Optional |
as specified by cfgrid |
Column header font |
headerFontSize |
Optional |
as specified by cfgrid |
Column header text size, in pixels |
headerItalic |
Optional |
as specified by cfgrid |
|
headerBold |
Optional |
as specified by cfgrid |
|
headerTextColor |
Optional |
|
Color of grid control column header text.
|
dataAlign |
Optional |
as specified by cfgrid |
Column data alignment:
|
headerAlign |
Optional |
as specified by cfgrid |
Column header text alignment:
|
numberFormat |
Optional |
|
Format for displaying numeric data in grid. See "numberFormat mask characters". |
values |
Optional |
|
Formats cells in column as drop-down list boxes; specify items in drop-down list. Example:values = "arthur, scott, charles, 1-20, mabel" |
valuesDisplay |
Optional |
|
Maps elements in values attribute to string to display in drop-down list. Delimited strings and/or numeric range(s). |
valuesDelimiter |
Optional |
, [comma] |
Delimiter in values and valuesDisplay attributes. |
The textColor
and bgColor
attributes accept the following kinds of values:
The syntax for an expression is as follows:
(CX operator string ? true_condition : false_condition)
The symbol meanings are as follows:
CX
: the column that contains the value to test. For the current column, use CX
; if n is the column to evaluate, use C
n; for example, C2
operator
: One of these operators: EQ
(equal), GT
(greater than), LT
(less than)string
: Value to compare against. A literal, such as (C2 EQ Johnson ? blue : green);
or numeric: (C2 LT 0 ? red : black)
true_condition
: Value for textColor
if condition evaluates to "true"
false_condition
: Value for textColor
if condition evaluates to "false"
If the string in the expression can be interpreted as a number, the comparisons in the expression are interpreted as numeric. Otherwise, the comparison is a string comparison.
This code shows an expression that displays the grid element in blue if the grid element contains the string "Pam"; or black, otherwise:
<cfgridcolumn name = "FirstName" textColor = "(CX EQ Pam ? blue : black)">
This example displays the text in red if the value in column 1 is greater than four; or black, otherwise:
<cfgridcolumn name = "FirstName" textColor = "(C1 GT 4 ? blue : black)">
You can use the following numberFormat
attribute mask characters, which correspond to those in the NumberFormat function, to format output in U.S. numeric and currency styles. For more information, see "NumberFormat". (This tag does not support international number formatting.)
For a code example, see cfgrid.