Used
with a cfgrid tag. Updates data
sources directly from edited grid data. This tag provides a direct
interface with your data source.
This tag applies delete row
actions first, then insert row actions, then update row
actions. If it encounters an error, it stops processing rows.
Forms tags
<cfgridupdate
grid = "grid name"
dataSource = "data source name"
tableName = "table name"
keyOnly = "yes|no">
password = "data source password"
tableOwner = "table owner"
tableQualifier = "qualifier"
username = "data source user name">
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.cfgrid, cfgridcolumn, cfgridrow, cfform, cfapplet, cfinput, cfselect, cfslider, cftextinput, cftree
ColdFusion
MX: Deprecated the connectString, dbName, dbServer, dbtype, provider,
and providerDSN attributes. They do not work, and might
cause an error, in releases later than ColdFusion 5.
Attribute |
Req/Opt |
Default |
Description |
|---|---|---|---|
|
Required |
Name of the |
|
|
Required |
Name of the data source for the update action. |
|
|
Required |
Name of the table to update. For ORACLE drivers, entry must be upper-case. For Sybase driver, entry is case sensitive; must be same case as used when table was created. |
|
|
|
|
Applies to the
|
|
Optional |
Overrides |
|
|
Optional |
Table owner, if supported. |
|
|
Optional |
Table qualifier, if supported. Purpose:
|
|
|
Optional |
Overrides |
The
following example lets you update a database by using a cfgrid tag
to add and delete entire records or to update the data in individual
cells. The cfgridupdate tag processes the data
from the submitted form and updates the database.
<!--- If the gridEntered form field exists, the form was submitted. Perform gridupdate. --->
<cfif IsDefined("form.gridEntered") is True>
<cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples" Keyonly="true"
tableName = "CourseList">
</cfif>
<!--- Query the database to fill up the grid. --->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Course_ID, Dept_ID, CorNumber, CorName, CorLevel, CorDesc
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</cfquery>
<h3>cfgrid Example</h3>
<I>Try adding a course to the database, and then deleting it.</i>
<cfform>
<cfgrid name = "FirstGrid" width = "450"
query = "GetCourses" insert = "Yes" delete = "Yes"
font = "Tahoma" rowHeaders = "No"
colHeaderBold = "Yes"
selectMode = "EDIT"
insertButton = "Insert a Row" deleteButton = "Delete selected row" >
</cfgrid><br>
<cfinput type="submit" name="gridEntered">
</cfform>...