|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Grid Data Selection Options
|
|
|
|
You can control how you want users to interact with your grid control. You can limit a user to simply browsing data displayed in the grid control, or you can enable several different selection options by specifying values in the SELECTMODE attribute.
You can specify the following selection behaviors in the SELECTMODE attribute:
- Single -- User selections are limited to a single cell in the grid control.
- Column -- When a user selects a cell, data from the column containing the selected cell is included in the selection.
- Row -- When a user selects a cell, data from the row containing the selected cell is included in the selection.
- Browse -- Users cannot select cells in the grid control.
- Edit -- Users can edit cell data.
|
|
|
|
Select mode and form variables |
|
|
|
Grid data is submitted in a CFFORM as form variables, depending on the value of the SELECTMODE attribute as follows:
- When SELECTMODE="Single" grid data is returned as grid_name.selectedname and the selected value.
- When SELECTMODE="Column" grid data is returned as a comma-separated list of all the values for the selected column.
- When SELECTMODE="Row" grid data is returned as grid_name.colum1_name and grid_name.column2_name and their respective values for the selected row.
- When SELECTMODE="Browse" no selection data is returned.
- When SELECTMODE="Edit" three one-dimensional arrays are created if cell data is changed.
|
|
|
|
Using the URL attribute |
|
|
|
When specifying a URL with grid items, the value of the SELECTMODE attribute determines whether the link is limited to a single grid item or extends to a grid column or row. When a user clicks on a linked grid item, a CFGRIDKEY variable is appended to the URL in the following form:
http://myserver.com?CFGRIDKEY=selection
The value of selection is determined by the value of the SELECTMODE attribute:
- When SELECTMODE="SINGLE" selection is the value of the column you clicked.
- When SELECTMODE="ROW" selection is a comma-separated list of column values in the clicked row, beginning with the value of the first cell in the selected row.
- When SELECTMODE="COLUMN" selection is a comma-separated list of row values in the clicked column, beginning with the value of the first cell in the selected column.
|
|
|
|
The HREF attribute |
|
|
|
You can use the HREF attribute to associate a hyperlink with a selected row or cell. ColdFusion interprets the value of the HREF attribute as either a query column that stores the text of a link or the text of the hyperlink itself. The destination specified either literally in the HREF attribute or by reference to the query column is resolved relative to the current application page.
In the following code fragment, the HREF attribute is used in two CFGRIDCOLUMN blocks. Because the HREF attribute refers to a CFGRIDCOLUMN, each row is associated with a different URL, based on the value of the dept_url column in the selected row. Note also that the last CFGRIDCOLUMN is a hidden column used to hide the value of the dept_url field.
<CFFORM NAME="GridForm"
ACTION="catch_grid10.cfm"
TARGET="Lower">
<CFGRID NAME="grid_ten"
HEIGHT=170
WIDTH=400
HSPACE=10
VSPACE=6
ALIGN="Right"
SELECTMODE="Row"
ROWHEADERS="Yes"
COLHEADERS="Yes"
QUERY="DeptList"
GRIDDATAALIGN="Left"
HIGHLIGHTHREF="No"
APPENDKEY="No"
SORT="Yes">
<CFGRIDCOLUMN NAME="dept_id"
HEADER="Department"
WIDTH=80
ITALIC="No"
HEADERALIGN="Center"
HEADERITALIC="No"
HEADERBOLD="Yes"
HREF="dept_url"
TYPE="Numeric">
<CFGRIDCOLUMN NAME="dept_name"
HEADER="Name"
ITALIC="No"
HEADERALIGN="Center"
HEADERITALIC="No"
HEADERBOLD="Yes"
HREF="dept_url">
<CFGRIDCOLUMN NAME="dept_url"
DISPLAY="No">
</CFGRID>
<INPUT TYPE="Submit" VALUE="Submit"> <BR>
</CFFORM>
|
|
|
|
The APPENDKEY attribute in CFGRIDKEY |
|
|
|
When a user selects a grid item and submits the form, the CFGRIDKEY variable is appended to the URL passed to the application page specified in the CFFORM ACTION attribute, in the form:
http://myserver.com?CFGRIDMKEY=selected_value
You can disable this key by setting the APPENDKEY="NO".
|
|
|
  
|
|
|
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.
|