Latest Web News

Facebook labelled a $5b waste of time
THE next time you see an employee hunched intently over the computer, don't imagine he or she is slaving over the office accounts or a report for the next shareholders meeting. Employees are more likely to be whiling away the hours on the social networking...

Telstra: Govt broadband 'all about money and Labor'
Telstra has accused the Coalition of turning the country's broadband network into an election issue rather than concentrating on how improvements in speed could affect Australians. Phil Burgess, Telstra's head of public policy and communications, said the Minister for...

Doctors move to save e-record
THE prognosis for a national electronic health record system may be grim but the Brisbane division of General Practice is salvaging parts of the federal Government's controversial $128 million HealthConnect project. The association of 800 GPs and 200 practices, known...

Labor calls in ACCC over 'fraudulent' WiMax maps
Labor will seek clarification from the regulator over the government's announcements on WiMax, accusing the Coalition of trying to defraud voters over the capabilities of the technology. Opposition communications spokesperson Stephen Conroy said today at...


08.21.07


Custom Grid Renderers W/ CFGRID

By Raymond Camden

I've been playing a bit with CFGRID lately (as have others) and I found that by taking a look at Ext's documentation, there are some very powerful features hiding within the CFGRID tag.

ColdFusion provides a function, ColdFusion.Grid.getGridObject, that when used gives you a handler to the underling Ext Grid object. By looking at the documentation, you can see which methods are available with the grid. One in particular I thought was pretty neat was the ability to add custom column renderers. What is that?

Well imagine you have data being fed into the grid that you do not have control over. For example - perhaps you have price information that isn't formatted nicely. Turns out Ext has a set of built in formatters that you can apply to grid columns, one of them being a money formatter. What if you have some other logic? Maybe you want to flag a price that is lower than 10 dollars? Again, using the Ext API, you can write your own formatter just for this purpose.

I've only just begun to scratch the surface of Ext, but here is a quick and dirty example to give you an idea of what is possible.


First lets create a simple grid:


I'm using a hard coded query with products and prices. This is then fed directly into the grid. Note that I'm not using Ajax here.

Now let's look at how we can add a custom column renderer. The first thing we need to do is to set up the page to call a function when the grid is done loading. We do this with ajaxOnLoad:


I've mentioned this hack before, and credit goes to Todd Sharp for discovering. Now let's look at the JavaScript:

Contiue reading this article.

About the Author:
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.

About DevWebProAU
DevWebProAU is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProAU delivers via news and expert advice New Strategies In Development.

DevWebProAU is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com NetworkNewz.com



-- DevWebProAU is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal  

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


Delivering IT Solutions DevWebProAU News Archives About Us Feedback DevWebProAU Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact