ColdFusion 9: New Attributes in CFGrid
ColdFusion 9 introduces four new attributes in CFGrid tag. These attributes are good addition to CFGrid which allows us to expand or collapse the entire grid. It can group the rows in CFGrid by mentioning the group column name to generate a collapsible rows group in the grid. We can also insert a new row in or provide a title to the entire CFGrid.
<cfquery name="qGetBooks" datasource="cfbookclub">
select title, genre
title="CF 9 CFGrid Enhancements"
<cfgridcolumn name="title" header="Book Title" />
<cfgridcolumn name="genre" header="Genre" />
All these new attributes are available only for HTML type grids. In the above code I defined the collapsible as true and assigned a value for the title attribute. The insert and insert button attributes will take effect only when the select mode is true. On clicking the Insert Book button at the bottom of the grid, will introduce a new row at the end and user can add a new record.
Over here are the output of the code.
Hiya Akbarsait! I see that your article is form last year but I have been looking around everywhere and thought I would drop you a line to ask you a question.' I have been using cfgrid and I love the layouts especially some of the newer features you point out above. I was wondering if you had any knowledge of how to make the grouped rows, using the groupfield attribute, show up as collapsed by default. Right now the default behavior is for all of the groups to be expanded. If I could have them collapsed by default it would help my layout tremendously. If you have any info it would be greatly appreciated. If not thanks anyway and have a good one. Steve
Akbarsait, Unfortunately the collapsible thing only works for non-dynamic grids, so not for grids being populated via a Bind. Otherwise it would have been a great feature.
Hi Akbarsait, I need to create a purchase order that gives the user the ability to add multiple items to it, The user enters the data, clicks on the "Add Another" Button, or "enter" , and a new row is added to the form and the previous data entered is kept intact, how can do this?
(Comments migrated from previous blog engine.)