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

cfapplet, cfform, cfgrid tags, cfinput, cfselect, cfslider, cftextinput, cftree

History

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.

Attributes

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
  • Yes: displays grid control text in italics
  • No
bold
Optional
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
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 checkbox; if cell is editable, user can change checkmark
  • string_noCase: user can sort grid data as case-insensitive text
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
  • Yes: displays column header in italics
  • No
headerBold
Optional
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
as specified by cfgrid
Column data alignment:
  • Left
  • Right
  • Center
headerAlign
Optional
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
, [comma]
Delimiter in values and valuesDisplay attributes.

Using expressions in textColor and bgColor 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:

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

Comments