BackUp LevelNext

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:

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:

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:

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".


BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.