Cool New cfGrid Tricks
ColdFusion 9The html format of cfgrid has some cool new tricks in ColdFusion 9. First the placement of a column can be moved by dragging it elsewhere in the grid. In the example below the 'aDate' column is moved:

Second, when you hover over a column and click on the menu drop down the following options appear which allow for sorting or removing a column (that can then be added back).

You may notice in this example that the sort options are greyed out. This is because, for some reason, sort is disabled by default on Boolean type columns. CF Mitrah found a simple solution for enabling sort posted in the comments of an entry on the four new data types.
I've rarely used cfgrid over the years but in ColdFusion 9 it starts to feel like its ready for the big leagues in part thanks to the new data types, the addition of grouping and inserting (see Akbarsait's blog entry for more) and being based on the impressive Ext JS 3.0 release.
Exploring ColdFusion 9: The Four New Data Types in CFGrid
ColdFusion 9ColdFusion 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:

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;
- string_noCase specifies that the column will be sorted without regards to case.
- The boolean type will show a checkbox, checked if the boolean is true. From this example you can see that it is smart enough to convert 0 and 1's into Boolean as well as true and false.
- The price column is set to numeric which limits the editing of the column to just numbers.
- Leaving the best for last is the date type which when editing displays a nice calendar option.

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>
ColdFusion One Liners Presentation at CFinNC Slides Posted
ColdFusion 8, ColdFusion 9, CFinNCThe slides and code from my ColdFusion One Liners presentation at CFinNC are now up on SlideSix.
View the presentation on SlideSix
I enjoyed giving the presentation and if you have any questions let me know.
Adobe Listens: Feedback Shows up in ColdFusion 9
ColdFusion Builder, ColdFusion 9Around two years, just after the successful launch of ColdFusion 8, I emailed some of the top dogs on the Adobe ColdFusion team about features for ColdFusion 9. These where my suggestions and whether they made CF9:
- An IDE. ColdFusion Builder is here and one I've been happily using exclusively since its release.
- Shorter Syntax/Full cfscript Support. The shorter syntax was an idea of mine to merge scripting in a tagging syntax. Looking back I'm not sure exactly how it would have worked but I am happy to see much improved support for cfscript. Writing a cfc in script syntax feels good and should help those picking up ColdFusion.
- cfspreadsheet. Adobe nailed this one with the new tag and numerous Spreadsheet* functions.
- cfaudio/cfvideo. My request was for recording and editing Flash movies and possibly other formats. A little disapointed although these features are availible with other tools in the Adobe arsenal. cfmediaplayer is a useful addition to ease the playing of Flash movies.
- Built in ORM support. The hibernate integration appears to be awesome so far.
- Stronger support for {} and []: Happy to see more uses for these useful short cuts.
- Optomize PDFs: Actually asked for this one later on but am delighted to see its inclusion.
The ColdFusion team did not listen just to me of course, from conversations I've had with them they listen to just about every blog post, review all ERs sent in and go out and talk to customers about their vision. I've participated in the latter and they are very good sessions.
Overall I'm excited with the new features in ColdFusion 9 and pleased that my feedback was listened to (and mostly showed up in the final release) but I'm actually more excited about the features I did not suggest such as:
- Advanced Caching
- SharePoint Integration
- Office Integration (including document to pdf conversion)
- Java Portal Integration
- Enhancements to Components
- Integration with the Solr search engine
- Faster Flash Remoting
- ColdFusion as a Service
Congratulations to the whole ColdFusion team and all of those who have worked on the release of 9!
Use cfajaximport to help with CF8 to CF9 migration
ColdFusion 8, ColdFusion 9This came up in Raymond Camden's CFUnited presentation this morning and he suggested I blog it so here it is.
Problem:
You have extended the cfajax tags by calling the extJS functionality directly. CF8 uses extJS 1.1 whereas CF9 is going to use extJS 3.0. There will be cases it appears where this will break your code as some features have changed from the 1.1 to 3.0 release.
Solution:
- Copy the needed JavaScript files (from /cfide/scripts/ajax/*) to another folder in the webroot (say /cfExtJS11/ajax/) and make sure you keep the folder structure.
- On the top of any pages where you the cfajax tags use the cfajaximport tag:
<cfajaximport scriptSrc="/cfExtJS11">
(Edit 10/14: I made a minor change to item 1 for clarification)
Ten ColdFusion 9 One-Liners
ColdFusion 9All great performers have repertoire of one-liners. ColdFusion is no different and here are some cool new ColdFusion 9 one-liners:
1. Take a Word document and convert it to PDF
<cfdocument format="pdf" srcfile="/mydoc.docx" filename="mydoc.pdf" />
2. Take a PDF and optimize it (remove extra images, bookmarks, etc that are not needed)
<cfpdf action="optimize" source="bigpdf.pdf" algo="Bicubic" destination="smallpdf.pdf">
3. Get an object/record of an artist based on the key
<cfset artist = entityLoad('artists',1,true)>
(Change it <cfset artist.setLastName('McCoy')>)
4. Save the object back to the database
<cfset entitySave(artist)>
5. Add a map to a page
<cfmap centeraddress="275 Grove Street Newton, MA 02466" zoomlevel="8" type="hybrid" />

6. Connect to an imap server
<cfimap action="open" server="imap.googlemail.com" username="" secure="yes" port="993" password="" connection="gmail">
7. Add a message box
<cfmessagebox type="prompt" name="mes" message="Enter Message" labelok="Send" multiline="true" width="400" />

8. Add a media player to a Flash video file
<cfmediaplayer source="/phone.flv" >

9. Put a query into a spreadsheet
<cfspreadsheet action="write" filename="test.xls" query="getArtists">
10. Create a multiple file upload UI
<cffileupload url="multiUploadProcess.cfm">
Ah, what the heck, here's a bonus one:
11. Process those files and save to the file system
<cffile action="uploadall" destination="#getTempDirectory()#">
Pretty cool stuff. All of these new features have a lot of other attributes and possibilities for customization.
There are even a few (creating a progress bar, converting a PowerPoint presentation) that I left off.






Loading....