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
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.
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 --->
    <cfif isdefined("form.gridentered") is true>
    <cfgridupdate grid="FirstGrid" datasource="cfsnippets"
       tablename="CourseList" keyonly="Yes">
    </cfif>
    <!--- query the database to fill up the grid --->
    <cfquery name="GetCourses" datasource="cfsnippets">
       select   Course_ID, Dept_ID, CorNumber, CorName, CorLevel, CorDesc
       FROM     CourseList
       ORDER by Dept_ID ASC, CorNumber ASC
    </cfquery>
    <html>
    <head>
    <title>cfgridrow example</title>
    </head>
    <body>
    <h3>cfgridrow Example</h3>
    <I>Try adding a course to the database, and then deleting it.</I>
    <!--- call the cfform to allow us to use cfgrid controls --->
    <cfform action="cfgridrow.cfm">

    <!--- When inserting rows while running under UNIX, you must also specify
    a value for Course_ID --->
    <!--- cfgridcolumn tags are used to change the parameters involved in
    displaying each data field in the table--->

    <cfgrid name="FirstGrid" width="600" query="GetCourses" insert="yes"
       delete="yes" sort="yes" font="tahoma" bold="no" italic="no"
       appendkey="no" highlighthref="no" griddataalign="left" gridlines="yes"
       rowheaders="yes" rowheaderalign="left" rowheaderitalic="no"
       rowheaderbold="no" colheaders="yes" colheaderalign="left"
       colheaderitalic="no" colheaderbold="no" selectcolor="red"
       selectmode="edit" picturebar="no" insertbutton="to insert"
       deletebutton="to delete" sortascendingbutton="sort asc"
       sortdescendingbutton="sort desc">
       <cfgridcolumn name="Dept_ID" header="Department" headeralign="left"
    dataalign="left" bold="yes" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="yes">
       <cfgridcolumn name="CorNumber" header="Course ##" headeralign="left"
    dataalign="left" bold="no" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorName" header="Name" headeralign="left"
    dataalign="left" font="times" bold="no" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorLevel" header="Level" headeralign="left"
    dataalign="left" bold="no" italic="no" select="yes" display="yes"
    headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorDesc" header="Description" headeralign="left"
    dataalign="left" bold="no" italic="no" select="yes" display="yes"
    headerbold="no" headeritalic="no">
       <cfgridcolumn name="Course_ID" header="Course ID (Do Not Specify on NT)"
    dataalign="left" bold="no" italic="no" select="yes" display="yes"
    headerbold="no" headeritalic="no">
    </cfgrid>

    <!--- send the grid back to this page, where we  determine whether anything has
    changed, and thus whether to run the cfgridupdate --->
    <input type="Submit" name="submit" value="Apply Changes">
    <input type="hidden" name="gridEntered" value="yes">

    <h3>Example Two</h3>
    <p>This grid shows how the same grid can be built using cfgridrow with cfloop
    (i.e., defining query external to cfgrid, rather than within cfgrid).</p>
    <!--- cfgridcolumn is used to define  container columns.
         cfgridrow is used to define the data put into those containers --->
    <cfgrid name="SecondGrid" width=600 insert="no"
       delete="no" sort="yes" bold="no" italic="no"
       appendkey="no" highlighthref="no" griddataalign="left" gridlines="yes"
       rowheaders="no" rowheaderalign="left" rowheaderitalic="no"
       rowheaderbold="no" colheaders="yes" colheaderalign="left"
       colheaderitalic="no" colheaderbold="no" selectmode="browse"
       picturebar="yes">
       <cfgridcolumn name="Course_ID" dataalign="left" bold="no" italic="no"
    select="no" display="no" headerbold="no" headeritalic="no">
       <cfgridcolumn name="Dept_ID" header="Department" headeralign="left"
    dataalign="left" bold="yes" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="yes">
       <cfgridcolumn name="CorNumber" header="Course ##" headeralign="left"
    dataalign="left" bold="no" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorName" header="Name" headeralign="left"
    dataalign="left" font="times" bold="no" italic="no"
    select="yes" display="yes" headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorLevel" header="level" headeralign="left"
    dataalign="left" bold="no" italic="no" select="yes"
    display="yes" headerbold="no" headeritalic="no">
       <cfgridcolumn name="CorDesc" header="Description" headeralign="LEFT"
    dataalign="left" bold="no" italic="no" select="yes" display="yes"
    headerbold="no" headeritalic="no">
    <!--- use cfloop, loop through query, define cfgridrow data each time through
    --->
       <cfloop query="GetCourses">
          <cfgridrow data="#Course_ID#,#Dept_ID#,#CorNumber#,#CorName#,
    #CorLevel#,#CorDesc#">
       </cfloop>
    </cfgrid>
    </cfform>
    </body>
    </html>

DATA |
| Required
Delimited list of column values. If a value contains a comma, it must be escaped with another comma.