|Country:||Papua New Guinea|
|Published (Last):||9 March 2018|
|PDF File Size:||9.35 Mb|
|ePub File Size:||11.86 Mb|
|Price:||Free* [*Free Regsitration Required]|
Double-clicking again sorts the grid in descending order. You can also add sort buttons to the grid control. When users select grid data and submit the form, ColdFusion passes the selection information as form variables to the application page specified in the cfform action attribute.
Just as the cftree tag uses cftreeitem, cfgrid uses the cfgridcolumn and cfgridrow tags. You can define a wide range of row and column formatting options, as well as a column name, data type, selection options, and so on. You use the cfgridcolumn tag to define individual columns in the grid or associate a query column with a grid column.
Use the cfgridrow tag to define a grid that does not use a query as the source for row data. If a query attribute is specified in cfgrid, the cfgridrow tags are ignored. The cfgrid tag provides many attributes that control grid behavior and appearance.
This chapter describes only the most important of these attributes. Working with a data grid and entering data The following figure shows an example grid created using the cfgrid tag: The following table describes some navigating tips: Action Procedure Sorting grid rows Double-click the column header to sort a column in ascending order.
Double-click again to sort the rows in descending order. Rearranging columns Click any column heading and drag the column to a new position. Determining editable grid areas When you click an editable cell, it is surrounded by a yellow box.
Determining noneditable grid areas When you click a cell or row or column that you cannot edit, its background color changes. The default color is salmon pink. Editing a grid cell Double-click the cell. You must press Return when you finish entering the data. Deleting a row Click any cell in the row and click the Delete button. Inserting a row Click the Insert button. An empty row appears at the bottom of the grid. To enter a value in each cell, double-click the cell, enter the value, and click Return.
To populate a grid from a query: Create a new ColdFusion page named grid1. Save the file and view it in your browser. 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. Other modes are row, column, and edit.
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 let users add or delete grid rows, you also have to set the insert or delete attributes in cfgrid to Yes. Setting insert or delete to Yes causes the cfgrid tag to display insert and delete buttons as part of the grid, as the following figure shows: You can use a grid in two ways to make changes to your ColdFusion data sources: Create a page to which you pass the cfgrid form variables.
In that page perform cfquery operations to update data source records base on the form values returned by cfgrid. Pass grid edits to a page that includes the cfgridupdate tag, which automatically extracts the form variable values and passes that data directly to the data source.
Using cfquery gives you complete control over interactions with your data source. The cfgridupdate tag provides a much simpler interface for operations that do not require the same level of control. Controlling cell contents The value, valuesDisplay, and valuesDelimiter attributes of the cfgridcolumn tag let you control the data that a user can enter into a cfgrid cell in the following ways: By default, a cell is not editable. Use the type attribute to control sorting order, to make the fields check boxes, or to display an image.
For more information on controlling the cell contents, see the attribute descriptions in CFML Reference. How user edits are returned ColdFusion creates the following arrays as Form variables to return edits to grid rows and cells: Array reference.
Using CFGRID to Create Grids ColdFusion Help
Subscribe to RSS