Sam Farmer

Growing up I never imagined I would play bass guitar for the Dave Matthews Band. And indeed it never happened.

But I have become passionate about making software.

Exploring ColdFusion 9: The Four New Data Types in CFGrid

November 8, 2009

ColdFusion 9 brings four new data types to the html cfgrid.  As the docs state:

ColdFusion 9: Added boolean, date, numeric, and string_noCase to the
type attribute values supported in HTML grids

 

Lets take a look at these new types.  Here's a sample query from the art table that I added a date to and called it, well, aDate:

Query Dump

I'll display these using the following cfgridcolumn tags:

<cfgridcolumn name="artname" type="string_noCase"> <cfgridcolumn name="isSold" type="boolean"> <cfgridcolumn name="price" type="numeric"> <cfgridcolumn name="aDate" type="date">

Whats cool is that ColdFusion or ExtJS (I'm not sure which) is going to automatically try and convert these types from the data where possible.  The grid looks like this:

A quick run through of the various types;

Overall some pretty cool additions that make the cfgrid tag more useful.

Here's the full code to generate the above:

<cfquery name="getArt" datasource="cfartgallery"> select ARTID, ARTNAME, DESCRIPTION, ISSOLD, PRICE, CURRENT_DATE aDate  from ART  </cfquery> <cfdump var="#getArt#" top="10">  <cfform> <cfgrid format="html" name="art" query="getArt" align="left" selectmode="edit">  <cfgridcolumn name="artname" type="string_noCase">  <cfgridcolumn name="isSold" type="boolean">  <cfgridcolumn name="price" type="numeric">  <cfgridcolumn name="aDate" type="date"> </cfgrid> </cfform>


No Comments

Some comments have been lost over the years due to moving hosts.

More


More blog entries that I have written.

Code coloring by PRISM.