Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 739

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Reviewing the code
The following table describes the highlighted code and its function:
Code
<cfgrid name="employee_grid" query="empdata"
selectmode="single">
<cfgridcolumn name="Emp_ID">
<cfgridcolumn name="LastName">
<cfgridcolumn name="Dept_ID">
Creating an editable grid
You can build grids to allow users to edit data within them. Users can edit individual cell data, as well as insert, update,
or delete rows. To enable grid editing, you specify
You can let users add or delete grid rows by setting the
the
and
attribute to Yes causes the
insert
delete
You can use a grid in two ways to change your ColdFusion data sources:
• Create a page to which you pass the
data source records based on the form values returned by the
• Pass grid edits to a page that includes the
and passes that data directly to the data source.
Using the
tag gives you complete control over interactions with your data source. The
cfquery
provides a much simpler interface for operations that do not require the same level of control.
Controlling cell contents
You can control the data that a user can enter into a
• By default, a cell is not editable. Use the
• Use the
cfgridcolumntype
image.
• Use the
cfgridcolumnvalues
can use the
valuesDisplay
enter in the database. You can use the
lists.
valuesvaluesDisplay
• Although the
tag does not have a
cfgrid
specify a JavaScript function to perform validation.
For more information on controlling the cell contents, see the attribute descriptions for the
CFML Reference.
selectmode="edit"
insert
tag to display Insert and Delete buttons as part of the grid.
cfgrid
form variables. In that page, perform
cfgrid
cfgridupdate
cfgrid
attribute
cfgrid
attribute to control sorting order, to make the fields check boxes, or to display an
attribute to specify a drop-down list of values from which the user can choose. You
attribute to provide a list of items to display that differs from the actual values that you
valuesDelimiter
attribute, it does have an
validate
Last updated 1/20/2012
Description
Creates a grid named employee_grid and populate it with the
results of the query empdata.
If you specify a cfgrid tag with a query attribute defined and no
corresponding cfgridcolumn attributes, the grid contains all the
columns in the query.
Allows the user to select only one cell; does not allow editing.
Other modes are row, column, and edit.
Puts the contents of the Emp_ID column in the query results in
the first column of the grid.
Puts the contents of the LastName column in the query results
in the second column of the grid.
Puts the contents of the Dept_ID column in the query results in
the third column of the grid.
in the
tag.
cfgrid
or
attributes in the
delete
cfquery
tag.
cfgrid
tag, which automatically extracts the form variable values
cell in the following ways:
to edit cell contents.
selectmode="edit"
attribute to specify the separator between values in the
onValidate
tag to Yes. Setting
cfgrid
operations to update
tag
cfgridupdate
attribute that lets you
tag in the
cfgridcolumn
734

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents