User Guide

166 Chapter 2: ColdFusion Tags
cfgridrow
Description
Lets you define a cfgrid that does not use a query as source for row data. If a query attribute is
specified in cfgrid, the cfgridrow tags are ignored.
Category
Forms tags
Syntax
<cfgridrow
data = "col1, col2, ...">
See also
cfgrid, cfgridcolumn, cfgridupdate, cfapplet, cfform, cfinput, cfselect,
cfslider, cftextinput, cftree
Attributes
Usage
The following code shows how to populate a grid from a list with the cfgridrow tag:
<cfset MyList1 = "Rome,Athens,Perth,Brasilia">
<cfset MyList2 = "Italy,Greece,Australia,Brazil">
<cfform
name = "someform" action = "cfform.cfm">
<cfgrid name="GeoGrid" autowidth = "yes" vspace = "4"
height = "120" font="tahoma" gridlines="yes"
rowheaders="yes" rowheaderalign="left" colheaders="yes" >
<cfgridcolumn NAME="City" header="City">
<cfgridcolumn NAME="Country" header="Country">
<cfloop index="Counter" from="1" to="#ListLen(MyList1)#">
<cfgridrow data =
"#ListGetAt(MyList1,Counter)#,#ListGetAt(MyList2,(Counter))#">
</cfloop>
</cfgrid>
</cfform>
Example
For a code example, see cfgrid on page 152.
The following example populates two grids from the results of a query, as follows:
One uses cfgridrow within the cfquery tag, using the query to generate rows
One uses cfgridrow outside the cfquery tag, using a cfloop tag to generate rows.
<!--- This example shows cfgrid, cfgridcolumn, cfgridrow, cfgridupdate tags
--->
<!--- If the gridEntered form field has been tripped, perform the gridupdate
on the table specified in the database. Using the default value
keyonly=yes lets us change only the information that differs from
the previous grid --->
Attribute Req/Opt Default Description
data Required Delimited list of column values. If a value contains a comma, it
must be escaped with another comma.