Chapter 10: Building Dynamic Forms
141
How user edits are stored
The following arrays are created to keep track of edits to grid rows and cells:
For example, you have an updateable CFGRID called "mygrid" consisting of two
displayable columns, col1, col2, and one hidden column, col3. When an end user
selects and changes data in a row, arrays are created to store the original values for all
columns as well as the new column values for rows that have been updated, inserted,
or deleted.
mygrid.col1[
row_index
]
mygrid.col2[
row_index
]
mygrid.col3[
row_index
]
mygrid.original.col1[
row_index
]
mygrid.original.col2[
row_index
]
mygrid.original.col3[
row_index
]
Where row_index is the array index containing the grid data.
If the end user makes a change to a single cell in col2, you can reference the edit
operation, the original cell value, and the edited cell value in the following arrays:
<CFSET edittype = mygrid.RowStatus.Action[1]><BR>
<CFSET new_value = mygrid.col2[1]><BR>
<CFSET old_value = mygrid.original.col2[1]>
Multi-row edits
The use of arrays to track changes allows ColdFusion to manage changes to more than
one row in a CFGRID. ColdFusion coordinates entries in the arrays used to store edit
type (Update, Insert, or Delete), with arrays that store original grid data and edited grid
data. For each grid cell edit, an entry is created in the RowStatus array, and
corresponding entries are made in the arrays that store the new cell value and the
original cell value.
Arrays Used to Store Grid Cell Edit Information
Array reference
Description
gridname.colname [ row_index ]
Stores the new value of an edited
grid cell
gridname.Original.colname [ row_index ]
Stores the original value of the
edited grid cell
gridname.RowStatus.Action [ row_index ]
Stores the edit type made against
the edited grid cell.
Содержание COLDFUSION 4.5-DEVELOPING WEB
Страница 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Страница 14: ...xiv Developing Web Applications with ColdFusion...
Страница 26: ...xxvi Developing Web Applications with ColdFusion...
Страница 34: ...8 Developing Web Applications with ColdFusion...
Страница 70: ...44 Developing Web Applications with ColdFusion...
Страница 84: ...58 Developing Web Applications with ColdFusion...
Страница 114: ...88 Developing Web Applications with ColdFusion...
Страница 148: ...122 Developing Web Applications with ColdFusion...
Страница 174: ...148 Developing Web Applications with ColdFusion...
Страница 208: ...182 Developing Web Applications with ColdFusion...
Страница 244: ...218 Developing Web Applications with ColdFusion...
Страница 274: ...248 Developing Web Applications with ColdFusion...
Страница 288: ...262 Developing Web Applications with ColdFusion...
Страница 300: ...274 Developing Web Applications with ColdFusion...
Страница 350: ...324 Developing Web Applications with ColdFusion...
Страница 362: ...336 Developing Web Applications with ColdFusion...