Ext.Direct: Details on Data Marshalling

One of the core focuses, in the development of Ext JS 3.0, is the marshalling of data services under a centralized location. The intent is to make for a more portable application, where you can have a single touch point for data I/O that could easily be switched from one platform to another.

This is done through the new Ext.Direct package of classes, and many have been waiting on some detailed information on what it is and how to use it. This morning the Ext Blog got an update: Ext JS 3.0 - Remoting for Everyone. This explains Ext.Direct fairly well, even giving you a sample app to learn from, some sample code, links to some pre-constructed routers for several platforms, as well as a link to the Remoting Specification to write your own custom routers. Aaron Conran, Senior Software Architect and Ext Services Team Lead, wrote the ColdFusion Router. That's fitting, as Aaron's a long time ColdFusion guy, having contributed to the ColdBox project back in it's early days.

I'm excited about what Ext.Direct can mean for Ext - ColdFusion based applications, and I'll be deep diving this integration soon. I'll be curious to see how I can integrate CFQueryReader into the mix. I have an update to that which I hope to get out in the next few days.

Ext Conference: Day 1

Day 1 of the Ext JS Conference has been busy. Last night I had dinner and drinks with Jeff, a really nice guy who heads up development for a group writing web based interfaces to hardware appliances. Turns out Jeff is also the guy who introduced JavaScript to Douglas Crockford, who was today's keynote speaker. Douglas made sure to recognize Jeff at the beginning of his keynote, which I thought was a nice nod to the guy who helped give him direction in his career. Douglas ran us through a brief history of hypertext, the evolution of the web, JavaScipt, and the browser wars, before touching on the future of the web, some of the things in the new JavaScript specs being worked on through ECMA, and the fact that none of it would matter for years until the browser manufacturers would implement it. He did give props to Flash, AIR and SilverLight for trying to further the web experience where it has lagged so much over the years. He also spoke about the pitfalls of security in Web 2.0 applications, and the primary culprits of those issues (the browser manufacturers).

Before I go a whole lot further, let me tell you that the conference center, and their service to us, is fantastic. Held at the Ritz-Carlton Orlando, the location is beautiful with it's palm lined drives, a well groomed golf course winding around several 'water traps', and a huge pool with several fountains. The food has been exceptional, with an incredible meal at lunch, complete with salad, brazed chicken, and desert with complete table service (this as part of the conference). No buffet sandwhiches here, though a breakfast buffet would have been nice before that 830 session this morning. My room is about half the size of the one I had at the Hotel Rouge last year for WebManiacs, but it is very comfortable and service keeps it nice. The shower did flood the entire bathroom this morning and the in-room coffee is horribly weak (and small), but everything can't be perfect. I've also carried on my conference tradition of bringing a sinus infection with me, which is keeping me from the after-session activities this evening, but the concierge was able to get me covered with some NyQuil for the evening to try to knock this stuff out of me.

Aaron Conran, fellow ColdFusion developer and one of the original contributors to ColdBox, delivered the session covering what has changed and what's new within the 3.0 release, which is officially released tomorrow by Jack Slocum during his keynote. A great deal of work has been spent to make the upgrade fairly painless, with attention payed to backwards compatability, improvements to overall memory management (always important), and an eye towards keeping the code lean and mean, doing what is necessary to keep code size to a minimum and eliminate any unnecessary bloat. Menus and Toolbars have been converted into true Container objects, and the only significant markup changes appear to be to the Button objects.

There are several new visual components, maintaining the professional feel and consistency that has made Ext JS so compelling. Two that attracted a great deal of attention were the ListView and the Buffered Grid View. Sometimes you want the basic view afforded by a Grid, without having the need for (or the overhead of) things like drag and drop column ordering, sorting, and the like. The ListView gives you a basic grid style layout without all of that overhead, and a very trim DOM footprint as well, providing your view without unnecessary code bloat and browser memory overhead. The Buffered Grid View is a full Grid implementation that allows the browser to only render DOM for records in actual view, plus a few extra to make smooth transitions on scrolling, that automatically adds and removes DOM items when scrolling through your recordsets. The memory management improvements with this, and other changes, are very nice to see. Like the new .mon(), or 'managed on', methods that allow you to bind events in a temporary fashion, getting a proper cleanup from browser memory when that component gets destroyed. This was actually a method of Ext prior to it's 1.0 release, and has been heavily requested for this return.

Being the server-side guy that I've been for the last decade, the important new components came to the Ext.data package, with the addition of the Ext.data.Direct and Ext.data.DataWriter classes. Direct provides the ability to marshall your remote service call definitions into one container, calling your Ajax data requests from a centralized location with the ability to make multiple commands through a single Ajax request as well as call listeners on specific actions performed by Direct. Chris Scott did a presentation on Direct this afternoon, explaining how the developer has to create a server side Router to which Direct can attach it's requests, and showing us all a nice and very simple example (even if it was written in Ruby). The Ext Team provides a Reference for development of Routers in a number of server-side languages, including ColdFusion, PHP, Ruby, and .NET. The DataWriter class, covered in more depth in a future session, does for POST requests what the DataReader does for your GET requests, allowing a developer to define your routing of requests to send data back to the server. The combination of these classes with the existing classes of the Ext.data package really improves upon the power of using Ext with any server-side technology.

I was able to see the presentation on the Direct class because of a snafu with a scheduling change of the presentation of the Ext.air package. Originally these two sessions were the one conflict in my schedule, but they moved the Ext.air presentation session up a time slot (a change I didn't know of until after the fact) which allowed me the opportunity to sit in on Chris's session. Luckily the presentations are being recorded and are supposed to be available online after the conference. I'm glad they're doing this, since I had to leave during my final session of the day, on Ext.Core, due to the sinus issues that progressively worsened through the day. The Ext.air session is one I am very looking forward to watching.

The members of the Ext Team are a great group of guys. Abe, again, congratulated me on the book, and invited me to sit in on the Industry Experts panel tomorrow. I've had several people say they wished they had brought their copies of the book so Shea and I could have signed them for them. One attendee asked why PackT didn't have a booth setup somewhere, which is when I first noticed that their don't appear to be any outside sponsors for the conference. Ext appears to have financed the conference solely through the registration of the 200+ attending, which is pretty impressive considering the facility and it's services. On another note, ColdFusion has been publicly mentioned in several presentations, and with so many different server-side programmers represented here it is refreshing to hear so many comment that they should give ColdFusion a hard look.

And with that, I'm going to pack it in for the evening and pray that the NyQuil does it's job to kick the junk out of my head. Tomorrow looks to be an exciting day, with Jack's keynote releasing Ext 3.0, sessions on User Experience Design, Theming, and Performance Optimization. I'll be posting updates to Twitter and my Facebook profile throughout the day. If you're here, make sure to come up and say hi.

Orlando Bound...

So, in about an hour I head to the airport to attend the first ever Ext Conference in Orlando, FL. I'll be posting updates throughout the conference, both here and on Twitter. Jack Slocum and the Team will be releasing the long awaited 3.0, which looks to be a very compelling upgrade to the library. I'll be touching down around 6pm, and should get to the hotel sometime around 7 (I hope), so if you're already there look me up.

Ext Core 3.0 Beta Released

At an impressively lightweight 25kb, the new Ext Core 3.0 beta was released early this morning. With a detailed 75 page (if printed) manual, a number of ready made (and useful) examples, and an MIT license, Ext Core will be a major contendor in the Basic DOM and CSS manipulation space. Definitely worth a hard look.

CF 8 and Ext: Presenting to Phoenix CFUG

March 25th, at 6:30pm MST (9:30 EDT, 8:30 CDT [Phoenix doesn't do Daylight Savings]), I will be presenting to the Phoenix ColdFusion User Group my presentation on ColdFusion 8 Ajax and Extension with Ext JS. For those not in the Phoenix area, you can attend over Adobe Connect.

Development Ties

On the last day of CFUnited 2005, a group of us were out on the patio having a final drink together. I got into a conversation with Clark Valberg about linguistics. I was a translator in latter half of my time in the military, and Clark was asking if I thought my experience with learning another language had helped me in learning to be a better developer?

I absolutely agreed. I have an aptitude for languages, and always have. It's something I've picked up, and I can generally get to a point where I can effectively communicate (at least on the simplest of terms) within a very short time. Programming isn't much different, if you think about it. When I first got into computing again, after leaving the Army, I was teaching myself ten different programming languages at the same time. I had a lot of catching up to do, being out of the game for so long, so I picked up some books, found online resources, and took to the task of getting up to speed.

Maybe that's why there are so many talented developers outside the US. In the US, we aren't required to learn another language out of necessity, whereas in most other countries of the world (not all, but most) it is very commonplace for people to speak two or more languages.

You can kind of apply this in the reverse, to some degree, as well. Those who only learn one development platform may be limiting themselves. Knowing one programming language inside and out can be a good thing, but learning others can also open a developer to new ways of approaching a challenge. I've known many developers who knew a server-side language (ColdFusion, ASP, PHP, whatever), but never bothered to learn JavaScript, or how to write well formed XHTML. To me, that's limiting. Even crippling.

What are your thoughts?

Ext Custom Data Reader for ColdFusion: More Info

I wrote an article for Packt, as a follow up to Learning Ext JS, and was surprised to find it's been on their site for a while now.

The article is a follow up on Chapter 12 on Custom Data Readers in Ext JS, replacing the reader in the chapter with the CFQueryReader, which is better tuned for reading JSON data returns of a ColdFusion Query object.

Learning Ext JS Released, and Getting Press

It's been a busy week, with a flood of feedback coming in on the newly released Learning Ext JS. In fact, I've been so busy that I forgot to tell my own readers that it was released! Peter, Steve, and J.J. all put up posts about the book coming out, for which I am grateful. Then Aaron followed after the release, with a post on the Press Release that my employer put out about my involvement with the book. Shea and Colin both have put up entries on the book, including a breakdown of the chapters. Then Shea announced it within the Ext JS Forums, which really brought some positive response, and led to the first review on Amazon.

Learning Ext JS Book Cover (photo)But for me, the biggest thing about this rollercoaster was when my copies of the book came in on Friday. I was at work, but my wife calls, and she and my daughter are in tears after reading the book's dedication. When I came home that night, Teresa put the book in my hands and said "You did it!" It's an odd moment, standing there with this book in my hands, just staring at this cover with my name on the bottom. One of the coolest things. I IM'd about it with Ray on Saturday morning, who I had asked authoring advice of before taking on the project, and he said "The hard copy makes it real."

So, now I'm on to finishing off a huge side project. I'm "eating my own dogfood", so to speak, as it's a rather large application with a single page Ext interface, communicating with ColdFusion via Ajax. I hope everyone enjoys the book as much as Shea, Colin, and myself enjoyed writing it. Let us know what you think.

ColdFusion Query Json Custom Data Reader For ExtJS

Adobe's implementation of JSON return for ColdFusion is great, and frustrating. They use a non-standard return in that, instead of the expected name/value pairs, they return first a COLUMNS element, listing the column names only once, and then the DATA array of the record set values. The column names are listed in the order with which the data is listed in each array element. This is great, in the fact that the data packets are much smaller than the traditional return (traditional meaning, that which is returned by most other app servers), but the down side is, it isn't traditional.

John Wilson wrote a custom Data Reader for the Ext JS library, to help with parsing the ColdFusion return. However, although it created records within a Data Store, it didn't handle the column aliasing you are usually capable of when defining fields, nor did it properly cast variables as it should. I finally had a chance to run it through Firebug, and step through the process, at which point I also really had a chance to review the custom extension.

While it worked, it really wasn't using the best tool for the job. The extension extended the Ext.data.DataReader base component. The ColdFusion return basically gives you an Array of records (the DATA), and Ext JS already provides an Ext.data.ArrayReader object that extends the JsonReader. So, after some refactoring and general tinkering, I now release the CFQueryReader custom Ext data reader.

Inspired by the CFJsonReader, originally writtin by John Wilson (Daemach).

This Custom Data Reader will take the JSON return of a ColdFusion Query object, rather returned straight up, or via the ColdFusion QueryForGrid() method.

The CFQueryReader constructor takes two arguments @meta : object containing single key/value pair for the 'id' of each record, equating to the 'mapping' of the column @recordType : field mapping object

The recordType object allows you to alias the returned ColdFusion column name (which is always passed in upper case) to any 'name' you wish, as well as assign a data type, which your ExtJS app will attempt to cast whenever the value is referenced.

ColdFusion's JSON return, for a ColdFusion Query object, will appear in the following format:

view plain print about
1{"COLUMNS":["INTVENDORTYPEID","STRVENDORTYPE","INTEXPENSECATEGORIESID",
2"STREXPENSECATEGORIES"],"DATA" :[[2,"Carpet Cleaning",1,"Cleaining"],
3[1,"Cleaning Service",1,"Cleaining"]]}

The ColdFusion JSON return on any query that is first passed through ColdFusion's QueryForGrid() method will return the object in the following format:

view plain print about
1{"TOTALROWCOUNT":3, "QUERY":{"COLUMNS":["MYIDFIELD","DATA1","DATA2"],
2"DATA":[[1,"Bob","Smith"],[6,"Jim","Brown"]]}}

The Ext.data.CFQueryReader is designed to accomodate either format automatically. You would create your reader instance in much the same way as the CFJsonReader was created:

view plain print about
1var myDataModel = [
2    {name: 'myIdField', mapping: 'MYIDFIELD'},
3    {name: 'data1', mapping: 'DATA1'},
4    {name: 'data2', mapping: 'DATA2'}
5];
6
7var myCFReader = new Ext.data.CFQueryReader({id:'MYIDFIELD'},myDataModel);

Notice that the 'id' value mirrors the alias 'name' of the record's field.

The CFQueryReader is available from the below download link. Anyone having any issues just post a comment. You may also find information on the Ext JS Forum Post.

Upcoming Book: Learning ExtJS

I've been rather quiet for quite a while now. I have a rather large side project I've been working on, written entirely with an ExtJS front-end and ColdFusion on the back-end. I'm hoping to get that into a QA phase in the next week or two. I also just celebrated my 39th birthday, my 8th wedding anniversary, my daughter is the rock star of the 1st grade (pulling straight A pluses in every category), and the holiday's are coming.

On top of everything else, I'm putting the final touches on Learning Ext JS, to go to press at the end of the week/beginning of next, and due out in December. I've stayed relatively quiet on this, as I wanted to wait until PackT, my publisher, officially released information on the book. Let me start by saying that a few years ago I never would have thought I'd be doing this much client-side development again. And I definitely wouldn't have imagined me contributing to a book about client-side development.

I began looking at ExtJS quite a while back, while contemplating how to "jazz up" and modernize some dated interfaces I was supporting. I thought that ExtJS was an exceptionally well thought out library of rich, consistant components and functionality. While I use JQuery almost exclusively for DOM queries and manipulation, I really didn't find enough consistency in the visual plugins at the time (this has improved with the latest round of the JQuery UI plugins). I began to learn of the real power of ExtJS, and became an even bigger fan when it was announced that Adobe was including it in Scorpio, the codename for ColdFusion 8, Adobe's first implementation of the ColdFusion web application platform since it's acquisition with the Macromedia merger. Sweet! A total win-win for me.

Back in June, PackT contacted me. It seems they had started to develop a book, but the primary author, Shea Frederick, had gotten bogged down in other commitments before being able to complete the project. Some Googling on their part led them to Colin Ramsay and myself, through Cutter's Crossing. So they contacted me to find out if I was interested. The timing on this was awful. I was just starting the previously mentioned side project, my daughter was on her very first summer vacation, and just a lot of things going on. But it was too good to pass up. Aside from the fame and glory (yeah, right!), I knew that there weren't any other books out there on ExtJS, and it would be an excellent book to get out there for all the people trying to learn this exciting library. After talking the pros and cons with Aaron West, and getting sign off from my family, I finally contacted the Jedi himself, Ray Camden, to get some info on the writing process. We talked about time (a lot), commitment (more), and fame (maybe a little) and fortune (nearly none). I finally went ahead and said I would do it.

So, here it is almost six months later. I took on the final three chapters of the book: working with data stores (think like browser cached data table sets), extending Ext objects to build your own custom components, and the book wrap-up, which covers all the little stuff many people miss because they aren't typically visible. Only one chapter has any server-side code (the data stores). PackT originally wanted to convert my ColdFusion examples to PHP, to conform with the rest of the book. This morning the publisher told me that they want to keep my ColdFusion examples, to show that the ExtJS library can work with any server-side technology.

So, they're taking pre-order now, just in time for the holidays. Let me know what you think.

Previous Entries / More Entries