Used within the cfform
tag. Puts a grid control (a table of data) in a ColdFusion form. To specify grid columns and row data, use the cfgridcolumn
and cfgridrow
tags, or use the query
attribute, with or without cfgridcolumn
tags.
<cfgrid
name = "name"
height = "integer"
width = "integer"
autoWidth = "Yes" or "No"
vSpace = "integer"
hSpace = "integer"
align = "value"
query = "query_name"
insert = "Yes" or "No"
delete = "Yes" or "No"
sort = "Yes" or "No"
font = "column_font"
fontSize = "size"
italic = "Yes" or "No"
bold = "Yes" or "No"
textColor = "web color"
href = "URL"
hrefKey = "column_name"
target = "URL_target"
appendKey = "Yes" or "No"
highlightHref = "Yes" or "No"
onValidate = "javascript_function"
onError = "text"
gridDataAlign = "position"
gridLines = "Yes" or "No"
rowHeight = "pixels"
rowHeaders = "Yes" or "No"
rowHeaderAlign = "position"
rowHeaderFont = "font_name"
rowHeaderFontSize = "size"
rowHeaderItalic = "Yes" or "No"
rowHeaderBold = "Yes" or "No"
rowHeaderTextColor = "web color"
colHeaders = "Yes" or "No"
colHeaderAlign = "position"
colHeaderFont = "font_name"
colHeaderFontSize = "size"
colHeaderItalic = "Yes" or "No"
colHeaderBold = "Yes" or "No"
colHeaderTextColor = "web color"
bgColor = "web color"
selectColor = "web color"
selectMode = "mode"
maxRows = "number"
notSupported = "text"
pictureBar = "Yes" or "No"
insertButton = "text"
deleteButton = "text"
sortAscendingButton = "text"
sortDescendingButton = "text">
</cfgrid>
cfgridcolumn
,
cfgridrow
,
cfgridupdate
,
cfapplet
,
cfform
,
cfinput
,
cfselect
,
cfslider
,
cftextinput
,
cftree
,
cftreeitem
ColdFusion MX: Changed the rowHeaderWidth
attribute: ColdFusion does not use the rowHeaderWidth
attribute. You can omit it.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
name |
Required |
|
Name of grid element. |
height |
Optional |
300 |
Height of grid control, in pixels. |
width |
Optional |
300 |
Width of grid control, in pixels. |
autoWidth |
Optional; see description |
No |
|
vSpace |
Optional |
|
Vertical space above and below grid control, in pixels. |
hSpace |
Optional |
|
Horizontal space to left and right of grid control, in pixels. |
align |
Optional |
|
Alignment of the grid cell contents:
|
query |
Optional |
|
Name of query associated with grid control. |
insert |
Optional |
No |
|
delete |
Optional |
No |
|
sort |
Optional |
No |
The sort button performs simple text sort on column. User can sort columns by clicking column head or by clicking sort buttons. Not valid with
|
font |
Optional |
|
Font of column data in the grid control. |
fontSize |
Optional |
|
Size of text in the grid control, in points. |
italic |
Optional |
No |
|
bold |
Optional |
No |
|
textColor |
Optional |
Black |
Color of text in grid control; hex or text. Hex value or supported named color; see name list in the Usage section. For a hex value, use the form For a list of the supported named colors, see cfchart. |
href |
Optional |
|
URL o r query column name that contains a URL to hyperlink each grid cell with. |
hrefKey |
Optional |
|
The query column to use for the value appended to the |
target |
Optional |
|
Target of |
appendKey |
Optional |
Yes |
|
highlightHref |
Optional |
Yes |
|
onValidate |
Optional |
|
A JavaScript function to validate user input. The form object, input object, and input object value are passed to routine, which returns True if validation succeeds; False otherwise. |
onError |
Optional |
|
A JavaScript function to execute if validation fails. |
gridDataAlign |
Optional |
Left |
|
gridLines |
Optional |
Yes |
|
rowHeight |
Optional |
|
Minimum row height, in pixels, of grid control. Used with |
rowHeaders |
Optional |
Yes |
|
rowHeaderAlign |
Optional |
Left |
|
rowHeaderFont |
Optional |
|
Row label font. |
rowHeaderFontSize |
Optional |
|
Row label text size in grid control, in points. |
rowHeaderItalic |
Optional |
No |
|
rowHeaderBold |
Optional |
No |
|
rowHeaderTextColor |
Optional |
Black |
Text color of grid control row headers.
|
colHeaders |
Optional; see description |
Yes |
|
colHeaderAlign |
Optional |
Left |
|
colHeaderFont |
Optional |
|
Font of column header in grid control. |
colHeaderFontSize |
Optional |
|
Size of column header text in grid control, in points. |
colHeaderItalic |
Optional |
No |
|
colHeaderBold |
Optional |
No |
|
colHeaderTextColor |
Optional |
|
Color of grid control column headers.
|
bgColor |
Optional |
|
Background color of grid control.
|
selectColor |
Optional |
|
Background color for a selected item.
|
selectMode |
Optional |
Browse |
Selection mode for items in grid control.
|
maxRows |
Optional |
|
Maximum number of rows to display in grid. |
notSupported |
Optional |
(See Description) |
Text to display if page that contains Java applet-based cfform control is opened by a browser that does not support Java or has Java support disabled. Default: "<b> Browser must support Java to view ColdFusion Java Applets</b>" |
pictureBar |
Optional |
No |
|
insertButton |
Optional |
Insert |
Insert button. Takes effect only if |
deleteButton |
Optional |
Delete |
Text of Delete button text. Takes effect only if |
sortAscendingButton |
Optional |
A -> Z |
Sort button text |
sortDescendingButton |
Optional |
Z -> A |
Sort button text |
You can populate a cfgrid
with data from a cfquery
. If you do not specify any cfgridcolumn
entries, ColdFusion generates a default set of columns, which includes each column in the query. A default header for each column is created by replacing hyphen or underscore characters in the table column name with spaces. The first character, and any character after a space, are changed to uppercase; all other characters are lowercase.
This tag requires the client to download a Java applet; therefore, this tag might be slightly slower than using an HTML form element or the cfinput
tag to get the same information.
For this tag to work properly. the browser must be JavaScript-enabled.
This tag requires an end tag.