ColdFusion 9: New Attributes in CFGrid

  Oct 16, 2009     18907 Views      ColdFusion       Comments (3)   

ColdFusion 9 introduces 4 new attributes in CFGrid tag. These attributes are great addition to CFGrid which allows us to expand or collapse the entire grid, we can group the rows in CFGrid by mentioning the group column name which generates a collapsible group of rows in the grid, we can insert a new row in the Grid and we can give a title to the entire CFGrid.


<cfquery name="qGetBooks" datasource="cfbookclub">
   select   title, genre
   from   books
</cfquery>

<cfform name="gridform">
   
   <cfgrid
      name="BooksGrid"
      format="HTML"
      query="qGetBooks"
      title="CF 9 CFGrid Enhancements"
      collapsible="true"
      groupfield="genre"
      selectmode="edit"
      insert="true"
      insertbutton="Insert Book"
      width="250">

      
         <cfgridcolumn name="title" header="Book Title" />
         <cfgridcolumn name="genre" header="Genre" />
   </cfgrid>

</cfform>

All these new attributes are available only for HTML type grids. In the above code I have defined the collapsible as true and assigned a value for the title attribute. The insert and insertbutton attributes will take effect only when the selectmode 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.

Here are the screen-shots of the above code output.
CFGrid with Title, Group, Collapsible

CFGrid with New Record Insertion

CFGrid with Collapsible Feature



Comments

1. Steve on Jul 16, 2010 at 10:21 AM

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

2. Sebastiaan on Sep 12, 2011 at 9:54 AM

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.

3. jack on Jan 13, 2012 at 11:22 PM

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?

About Me

CFML/Web/Salesforce/Agile Enthusiast, Husband & Dad, an avid learner & android fan. Creator of GetCFMLJobs.com who works as a Tech Consultant in Toronto, Canada.

GetCFMLJobs.com!
Get Your Next CFML Job!
ColdFusion Tuts
ColdFusion Tutorials & Resources


Categories

Adobe Agile AppCore Creator BlogCFC Books Bootstrap CFBuilder CFEclipse CFML Chennai CFUG Chrome Extensions ColdFusion Google IIS India Learning MySQL Railo Subversion Tools & Utilities Web Windows 7


Archives

2018 2017 2016 2014 2013 2012 2011 2010 2009 2008

Search


Akbarsait © 2008 - 2019 | Hosting provided by Vivio Technologies

Home | Blog | Sitemap | RSS Feed