Whatever message this page gives is out now! Go check it out!
<cfgrid>
name="name"
appendKey="yes|no"
autoWidth="yes|no"
bgColor="web color"
bind="bind expression"
bindOnLoad="yes|no"
bold="yes|no"
colHeaderBold="yes|no"
colHeaderFont="font_name"
colHeaderFontSize="size"
colHeaderItalic="yes|no"
colHeaderTextColor="web color"
collapsible="false|true"
delete="yes|no"
deleteButton="text"
enabled="yes|no"
font="column_font"
fontSize="size"
format="html|xml"
gridDataAlign="left|right|center"
groupfield="column name"
height="integer"
href="URL"
hrefKey="column_name"
hSpace="integer"
insert="yes|no"
insertButton="text"
italic="yes|no"
maxRows="number"
multirowselect="yes|no"
notSupported="text"
onBlur="ActionScript"
onChange="ActionScript or bind expression"
onError="JavaScript function name"
onFocus="ActionScript function"
onLoad="JavaScript function name"
onValidate="JavaScript function name"
pageSize="number of rows"
preservePageOnSort="yes|no"
query="query name"
resetHead="true|false"
rowHeight="pixels"
selectColor="web color"
selectMode="mode"
selectOnLoad="yes|no"
stripeRowColor="web color"
stripeRows="yes|no"
style= "style specification"
target="URL_target"
textColor="web color"
title="text"
tooltip="text"
visible="yes|no"
width="integer">
<cfgrid>
zero or more cfgridcolumn and cfgridrow tagsYou can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. |
| Attribute | Req/Opt; formats | Default | Description |
| name | Required; all | Name of the grid control. | |
| appendKey | Optional;HTML | yes |
|
| autoWidth | Optional;HTML | no |
|
| bgColor | Optional; all | Background color of the control. For most formats, can be a hexa-decimal format or a named color. For a hexadecimal value, use the form "##xxxxxx", where x = 0-9 or A-F; use two number signs or none. For a list of the supported named colors, see cfchart.
| |
| bind | Optional; HTML | A bind expression used to fill the contents of the grid. Cannot be used with the query attribute. For more information, see Binding data to form fields in Using Ajax Data and Development Features in the Developing ColdFusion Applications. | |
| bindOnLoad | Optional; HTML | yes |
|
| bold | Optional; all | no |
|
| colHeaderBold | Optional; all | no |
|
| colHeaderFont | Optional; all | Font of column header. | |
| colHeaderFontSize | Optional; all | Size of column header text, in points. | |
| colHeaderItalic | Optional; all | no |
|
| colHeaderTextColor | Optional; all | Color of column headers.
| |
| collapsible | Optional; HTML | False | A Boolean value specifying whether the user can collapse the entire grid by clicking an arrow on the title bar. Specifying this attribute adds a title bar to the grid. |
| delete | Optional;HTML | no |
|
| deleteButton | Optional;HTML | Delete | Text for the Delete button; takes effect only if selectmode="edit". |
| enabled | Optional;Flash | yes | Flash format only: Boolean value that specifies whether the control is enabled. A disabled control appears in light gray. |
| font | Optional; all | Font of text. | |
| fontSize | Optional; all | Size of text, in points. | |
| format | Optional; all | html |
|
| gridDataAlign | Optional; | left |
|
| groupField | Optional; HTML | Don't group | Puts the grid rows into groups, organized by the column specified in this attribute. Each group is collapsible and has a header with the column name, group field value, and number of entries in the group. If you set this option, the column pull-down menu shows two grouping options: The show in Groups option turns column grouping on and off. The Group By This Field option sets the grouping to use the selected column. Users display the pull-down menu by moving the mouse over a column head and clicking the down arrow that appears You can use this attribute with static grids only, do not use it with dynamic grids that get their data using bind expressions. |
| height | Optional; all | 300 | Height of the control, in pixels. If you omit the attribute in Flash format, the grid sizes automatically. |
| href | Optional;HTML | URL or name of a query column that contains URLs to hyperlink each grid cell with. | |
| hrefKey | Optional;HTML | A query column to use for the value appended to the href URL of each cell, if appendKey="True". If you use cfgridcolumn tags, the column must be specified in one of these tags. | |
| hSpace | Optional; | Horizontal space to the left and right of the control, in pixels. | |
| insert | Optional;HTML | no |
|
| insertButton | Optional; | Insert | Text for the Insert button; takes effect only if selectmode="edit". |
| italic | Optional; all | no |
|
| maxRows | Optional; all | Maximum number of rows to display in the grid. | |
| multirowselect | Optional; HTML | no | Allows selection of multiple rows. This is particularly useful in the cases where batch processing is required, for example, moving multiple records at a time. If yes, a check box appears as the first column of the grid, enabling selection of multiple records. A Select All/Deselect All option also appears. Note: If multirowselect="yes", then row data is sent as an array of structs as opposed to a struct if mutirowselect="no". Also, if the grid data is manipulated by the user, for example, using JavaScript, to move records when a button is clicked, set the method to POST. This is required as a GET method imposes restrictions on the amount of data that can be sent. |
| onBlur | Optional, Flash | ActionScript that runs when the grid loses focus. | |
| onChange | Optional;HTML, Flash | Flash format: ActionScript to run when the control changes due to user action in the control.HTML format: Required for HTML format grids that specify a bind attribute and a selectMode value of edit. A bind expression that calls a CFC method, JavaScript function, or URL to update the data source. If a URL is called, since the data is passed in JSON format to the URL page, use the function DeserializeJSON. The arguments cfgridrow and cfgridchanged must be serialized to JSON strings if a JavaScript bind is used to pass these arguments to a URL. | |
| onError | Optional;HTML | In HTML format grids, name of a JavaScript function to execute if an error occurs. | |
| onFocus | Optional,Flash | ActionScript that runs when the grid gets focus. | |
| onLoad | Optional | A custom JavaScript function to execute when the grid is loaded and rendered. | |
| onValidate | Optional; | A JavaScript function to validate user input. The form object, input object, and input object value are passed to the function, which must return true if validation succeeds; false otherwise. | |
| pageSize | Optional;HTML | 10 | The number of rows to display per page for a dynamic grid. If the number of available rows exceeds the page size, the grid displays only the specified number of entries on a single page, and the user navigates between pages to show all data. The grid retrieves data for each page only when it is required for display. This attribute is ignored if you specify a query attribute. |
| preservePageOnSort | Optional; HTML | no | Specifies whether to display the page with the current page number, or display page 1, after sorting (or resorting) the grid. If this attribute is yes, selections are preserved when the grid sorts. |
| query | Optional; all | Name of the query associated with the control. Cannot be used with the bind attribute. | |
| resetHead | Optional; HTML | If true then clears <head> tag. | |
| rowHeight | Optional XML | Minimum row height, in pixels. Used with cfgridcolumn type = "Image"; defines space for graphics to display in row. | |
| selectColor | Optional; all | Background color for a selected item.
| |
| selectMode | Optional; all | Selection mode for items in the control.
| |
| selectOnLoad | Optional; HTML | yes |
|
| stripeRowColor | Optional; HTML | The color to use for one of the alternating stripes. The bgColor setting determines the other color. | |
| stripeRows | Optional; HTML | no | Boolean value that indicates whether to make the rows stripes in alternating colors. |
| style | Optional;Flash | Must be a style specification in CSS format. Ignored for type="text". | |
| target | Optional;HTML, | The target frame or window in which to display the href URL; for example, "_blank". | |
| textColor | OptionalFlash, | Color of text. Can be a hexadecimal value or a named color. For a hexadecimal value, use the form "##xxxxxx", where x = 0-9 or A-F; use two number signs or none. For a list of the supported named colors, see cfchart. | |
| title | Optional; HTML | Text to display as a title at the top of the grid. Specifying this attribute adds a title bar to the grid. | |
| tooltip | Optional;Flash | Flash format only: text to display when the mouse pointer hovers over the control. | |
| visible | Optional;Flash | yes | Flash format only: Boolean value that specifies whether to show the control. Space that would be occupied by an invisible control is blank. |
| width | Optional; all | 300 | Width of the control. |
If you specify Flash format for this tag in an HTML format form, and you do not specify height and width attributes, Flash takes up more than the remaining visible area on the screen. If any other output follows the grid, including any form controls, users must scroll to see it. Therefore, if you follow a Flash grid in an HTML form with additional output, specify height and width values. |
SelectMode="single"
form.#GridName#.#ColumnName# = "SelectedCellValue"
SelectMode="column"
form.#GridName#.#ColumnName# = "ValueOfCellRow1,
ValueOfCellRow2, ValueOfCellRowN"
SelectMode="row"
form.#GridName#.#Column1Name# = "ValueOfCellInSelectedRow"
form.#GridName#.#Column2Name# = "ValueOfCellInSelectedRow"
form.#GridName#.#ColumnNName# = "ValueOfCellInSelectedRow"form.#GridName#.#ColumnName# form.#GridName#.original.#ColumnName# form.#GridName#.RowStatus.Action |
<cfloop index="ColName" list="#ColNameList#">
<cfif IsDefined("form.#GridName#.#ColName#")>
<cfoutput><br>form.#GridName#.#ColName#:<br></cfoutput>
<cfset Array_New = form[#GridName#][#ColName#]>
<cfset Array_Orig = form[#GridName#][original][#ColName#]>
<cfset Array_Action = form[#GridName#]RowStatus.Action>
<cfif NOT IsArray(Array_New)>
<b>The form variable is not an array!</b><br>
<cfelse>
<cfset size = ArrayLen(Array_New)>
<cfoutput>
Result Array Size is #size#.<br>
Contents:<br>
</cfoutput>
<cfif size IS 0>
<b>The array is empty.</b><br>
<cfelse>
<table BORDER="yes">
<tr>
<th>Loop Index</TH>
<th>Action</TH>
<th>Old Value</TH>
<th>New Value</TH>
</tr>
<cfloop index="LoopCount" from="1" to=#size#>
<cfset Val_Orig = Array_Orig[#LoopCount#]>
<cfset Val_New = Array_New[#LoopCount#]>
<cfset Val_Action = Array_Action[#LoopCount#]>
<cfoutput>
<tr>
<td>#LoopCount#</td>
<td>#Val_Action#</td>
<td>#Val_Orig#</td>
<td>#Val_New#</td>
</tr>
</cfoutput>
</cfloop>
</table>
</cfif>
</cfif>
<cfelse>
<cfoutput>form.#GridName#.#ColName#: NotSet!</cfoutput><br>
</cfif>
</cfloop>http://myserver.com?cfgridkey=selection |
<!--- Query the database to fill up the grid. --->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Course_ID, Dept_ID, CorNumber,
CorName, CorLevel
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</cfquery>
<h3>cfgrid Example</h3>
<i>Currently available courses</i>
<!--- cfgrid must be inside a cfform tag. --->
<cfform>
<cfgrid name = "FirstGrid" format="Flash"
height="320" width="580"
font="Tahoma" fontsize="12"
query = "GetCourses">
</cfgrid>
</cfform>