ExtJS 2.0 Grid Gotcha

I recently upgraded all of my former ExtJS code to utilize the updated 2.0 library. There are a lot of fantastic changes and additions here, but I did run into one or two snags. In a previous post I showed how to use Event Handlers and Item Renderers with the ColdFusion 8 Ajax implementation of the ExtJS 1.1.1 data grid. It works very similarly with a straight (non-CF) implementation, whereby I had defined an unbound column, in my ColumnModel, and applied a renderer to it so that an icon would appear with an onclick event attached to the cell click. It's a very straight forward process, that immediately broke with the 2.0 library. It took me a little bit of playing around, but I finally discovered what appears to be either a bug in the library, or a glitch in the documentation.

What made this column previously 'unbound' was the fact that no dataIndex was set to the column. It wasn't required. Acoording to the 2.0 documentation, the attribute is still supposed to be optional. However, when trying this with 2.0, I found that I would continually get an error. Only after duplicating my dataIndex (I applied my ID query column to the dataIndex, the same as my ID column), and then using the renderer to overwrite, did I finally get my working grid. It's a bit of a hack, but it did the job.

It's a small gotcha, but a gotcha none the less, so I wanted to let ya'll know. As I said before, there are some fantastic changes in the new 2.0 implementation, and already some nice plugins being developed by the community. Well worth taking a peek under the covers.

Find This Character, Please!

OK, if I had hair I would have pulled it out by now. For several months I've been getting this error from BlogCFC, but I can't track the true source to remove the offender:

Script Name: /rss.cfm?mode=full&mode2=cat&catid=9856ECF2-3048-71C2-17879EB46D54D46F Detail: An invalid XML character (Unicode: 0x19) was found in the element content of the document.

I can't find this character anywhere. No clues at all. But, it's playing havoc with some RSS readers, apparently, and loading my inbox. So, anybody have some suggestions how I might find this?

Ask Cutter: Calling functions when paging the CF8 DataGrid

Yesterday, Mischa posted the following comment on my post on CF8 Ajax Grid: Renderers and Events:

Hi Steve, thank you for this example and your explanation! Do I understand correctly that init will fire once? Is there a way to fire init or any other function when the user pages through the grid using the page forward button? Thanks! Mischa.

Great question! Yes, to my knowledge the init() method is only called once. And, chances are, you really want it to only be called once. However, when the grid is initialized, and on every paging request, the data store runs it's load() method. The data store object, one of the underlying ExtJS pieces of the data grid, has a publicly available event that you can listen for, 'load'. I would go something like this.

view plain print about
1reportGrid = function(){
2    grid = ColdFusion.Grid.getGridObject('reportsGrid');
3    cm = grid.getColumnModel();
4    ds = grid.getDataSource();
5    cm.setRenderer(2,redBold);
6
7     var gridHead = grid.getView().getHeaderPanel(true);
8 var tb = new Ext.Toolbar(gridHead, [{
9 text: 'Add Art',
10 handler : showRecWin
11 }]);
12
13    grid.reconfigure(ds,cm);
14
15    ds.on('load',function(){alert('it just loaded the Data Store')});
16}

It's that last line that's the kicker. What I've done here is used the data store's on() method to assign an Event Listener to the 'load' event, with my own custom function. This will now kick off with whenever the data store calls the load() method, which happens on initialization, as well as each paging request (forwards or backwards).

There is a wealth of available knowledge, for interacting with these components, that is available in the ExtJS 1.1 API documentation. Looking at their online examples gives you an idea of how these components are built and interact, and knowing that can point you to the API documentation that will help you get the job done.

The Year In Review

2007, The Year Of The Scorpio, was a fantastic year to be a ColdFusion developer. The release of ColdFusion 8 marked a new age in web application development, with so many new features and enhancements that should see some truly outstanding next generation applications in the years to come. As a community, the CF crowd has really been flourishing, with new releases in several major frameworks, the introduction of the RIAForge open source repository for Adobe related technologies, widely publicized adjunct technologies like Flex 3 and AIR approaching final release (spawning a new conference in 2008, showcasing all three technologies together), and the premier of our own developer's social networking site, ColdFusion Community. We saw the loss of the CFDJ albatross, while the Fusion Authority Quarterly, introduced at CFUnited 2006, has truly come out as an excellent ColdFusion developer's resource. And we can't forget our very own, ColdFusion specific, blog aggregator, ColdFusion Bloggers, introducing us to so many other great developers willing to share their knowledge and experiences, like the creative, and very colorful, examples provided by Ben Nadel.

I've always felt that a day without learning is a day that your dead from the neck up.I spent quite a bit of time this year learning new things, and sharing most. I've been slowly picking up Flex, put a little research into AIR, adopted JQuery heavily, run series of posts on developing on Apache and utilizing the outstanding components of the ExtJS library (the most trafficed posts on this blog). I tried to share some of the things I had learned about the new functionality of ColdFusion 8, started posting some General Coding Guidelines I've been writing for our company, and even got some first hand experience looking at the Current ColdFusion Job Market.

I look forward to sharing more in the year to come. I always look for, and appreciate, all of the feedback you readers send my way. I think the future for ColdFusion is extremely bright, and I can't wait to see what 2008 holds for us all.

2007 CFeMmys Voting Begins

The voting has begun on the 2007 CFeMmys. Todd Sharp began the CFeMmys last year, for the ColdFusion community to vote, and recognize, those who made contributions throughout the year. Somehow, someone made a mistake, and submitted Cutter's Crossing in the 'Best Blog' category. While I won't turn down any votes, it's a bit humbling to be included in such prestigious company (man, that's twice in two weeks!)

So, don't forget to head over and vote! Voting is through this Friday at noon. The competition has nothing to worry about, I couldn't bribe anyone even if I wanted too;) Best of luck to all the nominees!

ExtJS 2.0: Extending The RowExpander Plugin

Back on the 4th of December, the ExtJS team announced the official release of ExtJS 2.0. Sorry I'm a bit late to get to this, but I've been a little busy with a move, and other fun things. I had the excellent opportunity to preview the 2.0 release in advance, and I have to tell everyone that it is outstanding, a true work of art. The team has gone out of their way to pay attention to community feedback, gather information on the features that were most needed, and writing a truly elegant implementation of this library.

[More]

The Multi-Class BO Debate

Last Week, Peter Bell wrote a post, asking the ColdFusion community "How Many Classes Per Business Object?" The debate that came out of it was very interesting, with a number of people chiming in on the plusses and minuses around multiple classes. Some were in favor of multiple classes, some thought one was enough, a few thought the "OO Purists" were creating too much complexity.

[More]

I'm Speaking At CFManiacs 2008!

I can't be much more humbled than I am today. Last Friday I received an email from Steve Drucker, CEO of FigLeaf Software, inviting me to speak at the new WebManiacs Conference as part of CFManiacs 2008, May 19-23 in Washington, DC. FigLeaf is an Adobe partner, and has heavily been involved with ColdFusion, and the ColdFusion community, for as long as I can remember (Dave Watts, FigLeaf's CTO, at one time held an annual record, for three years in a row, for the most posts to the CF-Talk list [if I remember right]). The 5 day conference has an extemely impressive, and extensive, list of topics. Even more impressive is the caliber of the other speakers who have already committed to this conference. It is extemely humbling to be included in this company, many of whom helped me hone my skillsets along the way.

I'll be presenting Using and Extending the CF 8 AJAX Framework on Day 2, Lecture 4, 12 - 12:50 (date and time subject to change.) Here is a brief synopsis of my topic:

ColdFusion 8 provides a very robust framework for quickly prototyping rich 'ajaxified' applications, once again making 'the hard things easy.' This topic will cover a brief introduction to the new ajax components and functions included with ColdFusion 8, how they can quickly be used to provide very slick application prototypes, and how the use of the ExtJS API can further extend, or replace, that base functionality to create truly rich applications.
I'm very excited about this opportunity, and it looks like this will be a fantastic conference. I look forward to meeting some of you there.

CF8 Grid Renderers and Events Source

I had several people ping me for some sample code for my CF8 Ajax Grid: Renderers and Events posting, on (what else) custom cell renderers and event listeners. I have just uploaded a zip of commented source code to that post. Just click the 'Download' link at the base of the post for all the source code goodness:)

Back In Business

Alright, now I can get busy again. It's taken me some time, but I was finally able to find the personal bandwidth to set my home network back up. That means that I can now reconnect to my home server, with all of my sample code, playpens, Flex learning projects, etc., and that CFEclipse once again has something to connect to.

The weeks ahead are going to be fun, with a company holiday party, my daughter's impending sixth birthday, and the holiday itself, but I have a few things to put out here in the blogosphere for all the world to see. I have a cool extension to the ExtJS RowExpander plugin for the 2.0 DataGrid implementation, that needs a public sample before it's posted. A lot of folks have been asking for sample code for the cell renderer and cell click I mentioned in a recent post. And I still have to re-record a certain CF8 Ajax preso (hopefully this week).

So, I'm going to get back to work now to put together some code and some posts. Let me know what you're questions, comments, and war stories are.

Previous Entries / More Entries