CFGRIDCOLUMN |
Description
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.
Category
Forms tags

Syntax

    <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">

See also
cfgrid, cfgridrow, cfgridupdate, cfapplet, cfform, cfinput, cfselect, cfslider, cftextinput, cftree
History
ColdFusion MX: Changed behavior 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.
Using expressions in textColor and bgColor attributes

The textColor and bgColor attributes accept the following kinds of values:

- A color value literal
- A hex value
- An expression that selects a text color based on the evaluation of a Boolean expression

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 Cn; 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)">

numberFormat mask characters

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.)

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.

Example For a code example, see cfgrid.

NAME |
| Required
Name of grid column element. If grid uses a query, column name must specify name of a query column.

HEADER |
| Optional
Default value: "Yes" Column header text. Used only if cfgrid colHeaders = "Yes".

WIDTH |
| Optional; see Description
Default value: "Column head width" Column width, in pixels.

FONT |
| Optional
Default value: "As specified by cfgrid" Font of data in column.

FONTSIZE |
| Optional
Default value: "As specified by cfgrid" Size of text in column.

ITALIC |
| Optional

Default value: "As specified by cfgrid"

- Yes: displays grid control text in italics
- No

BOLD |
| Optional

Default value: "As specified by cfgrid"

- Yes: displays grid control text in bold
- No

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.

- Any color, in hex format
- Black
- Red
- Blue
- Magenta
- Cyan
- Orange
- Darkgray
- Pink
- Gray
- White
- Lightgray
- Yellow

BGCOLOR |
| Optional

Color of background of grid column, or an expression to manipulate color.

See Using expressions in textColor and bgColor attributes.

- Options: same as for textColor attribute

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

- Yes: user can select the column in grid control.
- No: user cannot edit column, regardless of cfgrid insert and delete values. If cfgrid selectMode = "Row" or "Browse", this value is ignored.

DISPLAY |
| Optional

Default value: "Yes"

- Yes
- No: hides column

TYPE |
| Optional

- image: grid displays image that corresponds to value in column (a built-in ColdFusion image name, or an image in cfide\classes directory or subdirectory referenced with relative URL). If image is larger than column cell, it is clipped to fit. Built-in image names are as follows:

- cd
- computer
- document
- element
- folder
- floppy
- fixed
- remote

- numeric: user can sort grid data numerically
- boolean: column displays as check box; if cell is editable, user can change checkmark
- string_noCase: user can sort grid data as case-insensitive text

HEADERFONT |
| Optional
Default value: "as specified by cfgrid" Column header font

HEADERFONTSIZE |
| Optional
Default value: "as specified by cfgrid" Column header text size, in pixels

HEADERITALIC |
| Optional

Default value: "as specified by cfgrid"

- Yes: displays column header in italics
- No

HEADERBOLD |
| Optional

Default value: "as specified by cfgrid"

- Yes: displays header in bold
- No

HEADERTEXTCOLOR |
| Optional

Color of grid control column header text.

- Options: same as for textColor attribute

DATAALIGN |
| Optional

Default value: "as specified by cfgrid"

Column data alignment:

- Left
- Right
- Center

HEADERALIGN |
| Optional

Default value: "as specified by cfgrid"

Column header text alignment:

- Left
- Right
- Center

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
Default value: ", [comma]" Delimiter in values and valuesDisplay attributes.