Justin Carter's madfellas.com

Book review: Ext JS 3.0 Cookbook by Jorge Ramon

A few months back the folks at Packt Publishing kindly sent me a free copy of the Ext JS 3.0 Cookbook by Jorge Ramon to review. I have to apologize for not getting this review published sooner, since I expected to have it online in January, but the last two months just flew by. So, without further ado...

extjscookbook The Ext JS 3.0 Cookbook is a straight forward, no nonsense book that is quick to read and easy to follow. It appears to be marketed towards developers who already have some experience with Ext JS however I also think anyone who has a good understanding of JavaScript but no real exposure to Ext JS will find the content extremely empowering.

In true cookbook style the articles are presented as recipes which show a screenshot of the finished product (where applicable) and guide you from start to finish. Each recipe contains a "How to do it" section in the form of full code examples, a "How it works" section which highlights the critical concepts of the recipe and a "See also" section which can point you towards other related recipes. Many recipes also include a "There's more" section which gives the author the opportunity to discuss quirks, best practices or other advanced aspects of the recipe, which is great for getting ideas about how to take an implementation that extra step further.

Chapter 1 introduces the fundamentals of working with the Ext JS framework plus a couple of things that first timers might find slightly scary like namespaces and extending Ext classes. These are definitely recipes that you would refer back to quite a few times as these more advanced concepts come into your applications.

Chapter 2 starts off a little heavy with Layouts; there is no "Hello world!" type example for just displaying a Panel, even though some of the other UI components are shown in their most basic forms in some later chapters. That said, the rendering of Layouts is one of the most important concepts in Ext JS and so, again, these recipes are something that you would refer back to quite often until you have your head around them all.

Chapters 3 to 9 deal well with introducing the Ext JS UI components and how they would be used in a typical application to solve common problems. It's important to note that these recipes aren't just rehashes of the demos that ship with Ext JS as they go into quite a bit more detail on how components can be implemented to work together. The picks of the recipes for me are probably the ones that deal with related combo boxes, the JSON Writer and the drag and drop examples. There are also bunch of new Ext 3.x components in there such as the Grid Row Editor, the new List View as a light-weight, high performance grid component, the new Button layouts in Toolbars, and the entire of Chapter 9 is dedicated to the new Charting components. There are a few recipes that are almost carbon copies of others with just one or two attributes changed to show off subtle configuration options in some components, and perhaps these could have been condensed into one recipe, but it doesn't really detract from the variety of recipes considering there are 109 in total. Overall the recipes have very good coverage of the component's different uses and in many cases show the implementation from the front-end right through to the back-end exposing data from a MySQL database.

Chapter 10 has some very meaty recipes which deal with the more advanced Ext JS concepts such as Actions, lazy component instantiation, customising Ext components, building plugins and pre-configured classes. These are the types of things Ext JS developers should strive for in writing more robust, reusable code. This chapter could easily consume an entire book its own but I'm glad Jorge introduced these concepts here because it provides that initial guidance for reader to be able to go and learn even more about how to build great Ext JS apps.

In summary, I really enjoyed reading the Ext JS 3.0 Cookbook. If you're looking to take the next steps in learning Ext JS then I can recommend reading it from cover to cover, rather than just skimming between recipes, and you'll undoubtedly pick up a lot of great tips along the way.

The verdict: 4 out of 5 stars.

ColdExt RC 1 released!

Now up on RIAForge is the first Release Candidate of ColdExt. ColdExt is a ColdFusion tag library which makes it easier to build rich user interfaces using the amazing Ext JS library. ColdExt supports multiple CFML engines including CFMX 7, CF8, Railo 3.0.1 and OpenBD 1.0.

This release provides support for ExtJS 2.2.1 plus 6 new demos and 2 new user extensions - fileUploadField and gridSearch.

The main enhancement in RC 1 is to allow the JS and CSS resources for User Extensions to be loaded up front on the calling page, meaning that UX components can now be used in remote pages loaded via Ajax. This can be configured on the onReady tag using the uxLoad attribute, by specifying a comma delimited list of the extensions to load (based on the folder name of the extension in the /ext/ux folder) or by specifying "all" to load the resources for all extensions. For e.g.

<ext:onReady loadingMask="true" uxLoad="all">

Check out the latest demos for a bit more of a taste of ColdExt, and be sure to view the source of each demo to see how easy ColdExt is to implement.


coldext-rc-1


In other news, Kevin Roche wrote a nice series of blog posts on ColdExt back in December documenting some of the issues he faced in implementing some components. ColdExt also got a mention in Episode 2 of the CF Hour podcast by Dave Ferguson and and Michael Sean Becker â€" cheers guys :)

Also be sure to mark your calendars for April 14-16 2009 as the first ever Ext Conference will see the release of Ext JS 3.0! Expect a ColdExt release to follow during April.


If you have any feedback or feature requests for ColdExt please get in touch by leaving a comment here, using the contact form on the ColdExt project page or emailing me directly (my email address is in the readme.txt file in the downloadable zip!)

Ext JS 3.0 Designer tool... Whoa!

Jack Slocum has shared some sneak peak screencasts of the new Designer tool in Ext JS 3.0, and all I have to say is: coooool! It's a slick looking AIR app (built with Ext JS obviously) which lets you drag and drop UI components and data stores onto a canvas to design your UI with no real coding at all. Jack says that it is a tool that he would use himself which speaks volumes for how powerful a tool it will be.

Check it out for yourself :)

Watch the Ext JS 3.0 Designer preview

ColdExt Beta 3: Lots of Ext JS goodness!

Quite a lot has happened in this release of ColdExt, but I'll try to keep things as short and sweet... If that's possible :)

If you haven't heard of ColdExt before you are probably wondering what it is. ColdExt is a ColdFusion tag library which makes it easier to build rich user interfaces using the amazing Ext JS library. ColdFusion 8 has built-in support for some of the features of Ext JS 1.1, but the idea behind ColdExt is to stay up to date with the current Ext JS release (currently version 2.2) while providing support for as many UI components as possible, and to support CFMX7 as well as other CFML engines (more on this below).

I had originally planned to get Beta 3 out the door much sooner, but after reviewing the small amount of code generation I was doing I thought I should take it a step further. The result is that almost 75% of the ColdExt tags are being generated from a set of easy to update metadata (courtesy of some data scraping). In the event of a new version of Ext JS being released (as was the case with Ext JS 2.2) I can update existing tags with modified attributes or help text, across the whole library, in minutes instead of hours. This also makes it much easier to add new tags to support new components, which is fairly evident from the tag counts in this release (see below).

Making an appearance in Beta 3 is support for User Extensions which live in the new "ux" tag namespace, i.e. <ux:tagName>. The first wave of supported extensions include Grid Filters, Grid Group Summary, Grid Panel Resizer, Grid Row Expander, Grid Row Actions and Portals. If you're after support for a particular extension please put a request on the ColdExt forums and I'll see what I can do.


The changes to ColdExt Beta 3 in a nutshell:

  • Supports Ext JS 2.2
  • 12 new Ext core tags, 11 new User Extension tags (supporting 6 extensions) and 11 new Demos
  • Support for new UI components such as Checkbox and Radio Groups, Date Picker (different to Date Field), Label, Progress Bar and Status Bar
  • Support for User Extensions such as Grid Filters, Grid Group Summary, Grid Panel Resizer, Grid Row Expander, Grid Row Actions and Portals
  • 75% of the tags built by code generation, improving consistency and reliability
  • The <ext:init> tag is now implicit in the <ext:onReady> tag and so is no longer required on every page, however it is still useful for page-level settings such as turning on ext-all-debug.js with the debug attribute 
  • New loadingMask boolean attribute on the <ext:onReady> tag to enable a loading indicator while the page and resources load
  • New passThrough attribute on all tags to allow insertion of arbitrary JSON-formatted data (including potentially unimplemented Ext config properties) directly into Ext components for greater flexibility
  • New attributeCollection attribute on all tags to support passing a ColdFusion Struct into the tag as attribute config data
  • All string type attributes formatted with JSStringFormat() to avoid JavaScript errors
  • Updated ColdExt XML dictionary for CFEclipse tag insight


Also, good news on the CFML engine compatibility front is that ColdExt is now supported on Railo 3.0.0.008. The latest version on the Railo site is still 3.0.0.005 but you can update to the latest preview release by following the preview patch instructions.

Unfortunately there is no OpenBD support just yet as there is a bug with nested custom tags that I'm waiting on a fix for, but hopefully ColdExt will be supported on all major CFML engines soon. Feel the love :)

So without further ado, download ColdExt Beta 3 and see the demos in action!


P.S. I moved to London last week and I'll be attending the UKCFUG meeting on 6th November, so feel free to say "Hi" if you see me because I don't know any CF'ers in London yet :) Happily I've found a great room to rent which I'll be moving into on Sunday with my girlfriend, so now the big challenge is to find a job at a time where the world's economy is in rather poor shape. Fingers crossed...

ColdExt Beta 2 (Preview)

Wow, what a hectic yet amazing couple of months. As some of you may know, I recently packed up all my stuff back home in Australia and put it into storage to embark on a working holiday around Europe and the UK for a year or more. So far, though, it has been all holiday and no work. It's kind of fun being homeless and unemployed :)

Progress on ColdExt has been a little bit slower than I had hoped, but it's going well just the same. I've been able to fit in some coding on lazy mornings in the Netherlands, on the trains through Italy, on cheap Ryanair flights (though it's difficult with a 15" notebook and no elbow room), and even managed to tinker with a few demos in between sessions at Scotch on the Rocks (what a superb conference - I want to attend again next year!).

So what has changed since my last blog post and the Beta 1 release? Well, quite a lot actually. I'm calling this the Beta 2 "Preview" release because the documentation and demos haven't been finished but the majority of the tag support is there.

  • Most ColdExt tags can now create stand-alone Ext components (where appropriate). This means that tags don't always have to be nested which makes reusing some components much easier. This is done with the "var" attribute, previously only supported on a small number of the tags.
  • All tags now support listeners (where appropriate) to allow for event handling.
  • All tags can now be nested inside any ColdFusion tags as appropriate for flow control.
  • All tags can now be used in templates included by <cfinclude>.
  • Ext JS 2.1 is now supported, and as a result the license has also changed to GPL. Basically this means that if you were to use Ext JS in a product that you want to distribute and you don't want to be bound by the terms of the GPL then you would need to purchase an Ext JS commercial license. As far as ColdExt is concerned, I would offer it under a "do whatever you like with it" license if I could :)
  • There is a new documentation and demos application in which the demos are hosted, though they can also run stand-alone. You can easily view the source code of the demos right on the page too.
  • The ColdExt Wiki is now hosted on my own site to allow others to sign up and contribute to it. Unfortunately on RIAForge I was the only one that could modify the pages :(
  • Plus many more small fixes that have been reported on the ColdExt Forums on RIAForge...

Download ColdExt Beta 2 "Preview" from RIAForge


coldext-beta-2-preview


I'd like to thank the people that have been using ColdExt, reporting issues and assisting with new ideas and tag implementations. I know I haven't got around to implementing all of them yet but rest assured they are on my Todo lists in Basecamp. I particularly want to get to some of the Ext JS User Extensions (such as Paged Row Numberer, Grid Filters and Radio Groups) before releasing Beta 2 "proper". Until then, have a look at the ColdExt Beta 2 "Preview" Demos to get a taste of Ext goodness :)

ColdExt Wiki and Getting Started Tutorial

Having a bunch of custom tags and an XML dictionary for CFEclipse is one thing, but knowing how to use them is another! So last night I began working on every developer's favourite task... documentation :P

The ColdExt Wiki is now enabled on RIAForge and I have started out with baby steps by writing a Getting Started Tutorial which covers the absolute basic requirements of getting up and running with ColdExt.

I have a number of pages and tutorials planned for the wiki (some of which I have already made notes of on the wiki home page) and will get around to adding them as soon as I can. If anyone would like to help out with documentation (rofl!) or start a discussion about what documentation is needed the ColdExt Forums could be a good place to do it. I am open to suggestions!

The next release of ColdExt will very much be about better documentation and demos, in addition to more tags and enhancements of course :)


P.S. Does anybody know if it's possible to turn off WikiTerms on RIAForge? At the least I think a special token like __NOTERMS__ would be very useful.

ColdExt Beta 1 with CFEclipse tag insight!

I'm fairly excited about this release because it has some really cool stuff in it :) I've already dropped the biggest bombshell in the blog post title, which is support for tag insight in CFEclipse - very nice!, but there are a bunch of other nice updates and new features as well...

Changes at a glance include;

  • 7 new tags, 3 new grid demos
  • 90%+ of the tags have been updated with inline documentation
  • EditorGridPanel provides support for editable grids (only supports input and comboBox fields at this time, more to come very soon)
  • GroupingStore and GroupingView can now be used for grouping in both GridPanel and EditorGridPanel
  • GridRowNumberer can be used as a numbered column in Grids (though it doesn't support paged grids - by design from the Ext Team)
  • New <ext:html> tag for including arbitrary chunks of HTML inside panels and forms
  • Tags which don't require a closing tag will now work as a single tag without a trailing slash (partial support)
  • Tags which require a closing tag will throw an error if the closing tag is missing (partial support)
  • Initial implementation of attribute validation in some tags (starting with the panel tags to assist with rendering issues)
  • Support for including the Ext debugging JS
  • The bundled version of CFJSON has been updated to the latest v1.9
  • CFEclipse tag insight (/dictionary/coldext.xml)


Download ColdExt Beta 1 from RIAForge

Here are the new online demos:


I will refrain from posting screenshots and code listings of the demos this time round since you can download everything you need and view the working demos above (well, that and it's getting late here in Oz and I need some sleep!) :)

One thing you need to know though is how to set up the coldext.xml file to work in CFEclipse. Just browse to the "pluginsorg.cfeclipse.cfml_1.3.1.5dictionary" directory inside CFEclipse (your CFEclipse plugin version number may vary) and insert a copy of the ColdExt "dictionarycoldext.xml" file. Then in the same location, make a backup of the "dictionaryconfig.xml" (just in case) and then open it to make the following modification, inserting a single line to include the coldext.xml file:

<version key="cf8" label="Coldfusion 8">
    <grammar location="cf8.xml" />
    <grammar location="user.xml" />
   
<grammar location="coldext.xml" />
</version>

Give CFEclipse a restart and you should now be swinging with ColdExt tag insight!

coldext-tag-insight

*Note that at this stage only the attributes for about 90% of the tags are documented, I haven't gotten around to inline help for the actual tags themselves just yet...


If you have any feedback about this release feel free to post here in the comments or make use of the features on RIAForge:

All feedback, bug submissions, feature requests and comments are much appreciated :)

ColdExt Alpha 2 release

This release almost took me a couple of weeks to get out the door, and with 5 new tags and 13 updated/improved tags ColdExt is getting that little bit closer to being usable in the real world.

New tags include support for components such as accordions, tools with onclick handlers, tooltips, and xtemplates. The updated tags include better support for container layouts, tabs and treePanels. And there are 2 new demos to check out as well :) As usual, just extract the folders to your webroot to get up and running quickly.

Download ColdExt Alpha 2 from RIAForge

In this release the Ext files are no longer bundled so you will need to head over to the Ext JS Download page, grab the Ext 2.0.1 release and extract it to a temporary directory. Then in your webroot, where you have already placed the "coldext" and "demos" folders from the ColdExt Alpha 2 release, create a new folder called "ext". As per the image below, into the new "ext" folder you just need to place a copy of "ext-all.js" (from the "ext-2.0.1" folder) and "ext-base.js" (from the "ext-2.0.1adapterext" folder), and both the "css" and "images" folders (from the "ext-2.0.1esources" folder), then you should be right to go.

ColdExt folder structure

The first new demo is the ColdExt Accordion demo which is a replica of the Accordion Window that is in the Ext Desktop demo (minus the minimize/maximize functionality).

Here is a screenshot of the accordion demo as it is rendered:

coldext-accordion1 

And below is the main chunk of ColdExt code used to construct the accordion demo:

<ext:init />
<ext:onReady> 

    <ext:createChild renderTo="out" tag="h1">ColdExt Example Accordion (Ext Replica)</ext:createChild> 

    <ext:window var="myWindow" title="Accordion Window" layout="accordion" iconCls="icon-accordion"
                width="250" height="400" border="false" resizable="true" show="true">
        <ext:toolbar>
            <ext:toolbarButton icon="icons/fam/connect.gif">
                <ext:tooltip title="Rich Tooltips" text="Let your users know what they can do!" />
            </ext:toolbarButton>
            <ext:separator />
            <ext:toolbarButton icon="icons/fam/user_add.gif" tooltip="Add a new user" />
            <ext:toolbarButton icon="icons/fam/user_delete.gif" tooltip="Remove the selected user" />
        </ext:toolbar>
        <ext:treePanel id="myTree" title="Online Users" lines="false" rootVisible="false" margin="0 0 5 0">
            <ext:tool id="refresh">
                <ext:onclick>
                    var tree = Ext.getCmp('myTree');
                    tree.body.mask('Loading', 'x-mask-loading');
                    tree.root.reload();
                    tree.root.collapse(true, false);
                    setTimeout(function(){
                        tree.body.unmask();
                        tree.root.expand(true, true);
                    }, 1000);
                </ext:onclick>
            </ext:tool>
            <ext:rootNode>
                <ext:treeNode text="Friends" expanded="true">
                    <ext:treeNode text="Jack" iconCls="user" />
                    <ext:treeNode text="Brian" iconCls="user" />
                    <ext:treeNode text="Jon" iconCls="user" />
                    <ext:treeNode text="Tim" iconCls="user" />
                    <ext:treeNode text="Nige" iconCls="user" />
                    <ext:treeNode text="Fred" iconCls="user" />
                    <ext:treeNode text="Bob" iconCls="user" />
                </ext:treeNode>
                <ext:treeNode text="Family" expanded="true">
                    <ext:treeNode text="Kelly" iconCls="female" />
                    <ext:treeNode text="Sarah" iconCls="female" />
                    <ext:treeNode text="Zack" iconCls="green" />
                    <ext:treeNode text="John" iconCls="green" />
                </ext:treeNode>
            </ext:rootNode>
        </ext:treePanel>
        <ext:panel title="Settings">
            Something useful would be in here.
        </ext:panel>
        <ext:panel title="Even More Stuff">
            Something useful would be in here.
        </ext:panel>
        <ext:panel title="My Stuff">
            Something useful would be in here.
        </ext:panel>
    </ext:window> 

</ext:onReady>
 

Next up is the ColdExt Combobox demo which makes use of the XTemplate templating features that Ext provides. Templates are mostly used with the DataView component which the Combobox uses internally for rendering its list of items (note that I haven't yet implemented DataViews directly in ColdExt, they will be coming in the next release!). Not only can templates display simple data values but they can do logic, simple calculations and even implement member functions for more complex actions, as per the example below.

Here is a screenshot of the Combobox and XTemplate in action, rendering some data side-by-side in a list:

coldext-combobox-template1

And below is the code used to produce the Combobox. Take special note of the XTemplate tag and the nested member function that is used in the template, it's a super powerful feature IMO.

<ext:init />
<ext:onReady>

	<ext:createChild renderTo="out" tag="h1">ColdExt Custom Example Combobox</ext:createChild>

	<!--- coldext custom example - combobox --->
	<ext:createChild renderTo="out" tag="h2">Combobox 1 - XTemplate Example</ext:createChild>

	<ext:jsonStore var="myJSON" url="data.cfm">
		<ext:storeField name="id" />
		<ext:storeField name="country" />
	</ext:jsonStore>

	<ext:formPanel border="false" renderTo="out">
		<ext:comboBox name="country" emptyText="Select a Country..." hideLabel="true"
				displayField="country" valueField="id" store="myJSON">
			<ext:xtemplate>
				<tpl for="."><div class="x-combo-list-item">
					<span class="country">{country}<tpl if="this.isCode('KZ', id)">, very nice!</tpl></span>
					<span class="code">{id}</span>
				</div></tpl>
				<ext:script>
					isCode: function(a, b){
						return a == b;
					}
				</ext:script>
			</ext:xtemplate>
		</ext:combobox>
	</ext:formPanel>

</ext:onReady>
 

Anyway, that's about it for this release. If you have any questions, comments, feedback or feature requests please feel free to drop me a note in the comments.

Even my local KFC loves Ext JS?

I don't get drive-thru takeaway very often (honest!), but I couldn't help snapping this pic on my phone yesterday while grabbing some lunch at KFC... Proceed to ext window
Apparently the staff there love Ext JS too, or "ext windows" to be more precise :)

ColdExt first alpha release on RIAForge

Well, I've finally got the ColdExt code into a clean enough and complete enough state to release something that is useful enough to be played with :) There are a number of things this release doesn't do, but it does handle form functionality well enough that you can use it to build reasonably rich forms, validate the input and POST form data back to the server. Just a taste of things to come I guess!

Download ColdExt Alpha 1 from RIAForge

ColdExt comes bundled with the latest Ext 2.0.1 release so you don't need to download it separately. Basically you can just drop the "coldext" and "ext" folders into your web root, set your Application Name in an application.cfc/cfm and start playing with it immediately.

At this stage the examples are very light (check the /demos folder), but if you are familiar with Ext or don't mind browsing the Ext documentation and the Ext examples then I'm sure you will pick things up in no time (there are LOTS of attributes that can be used with each tag if you want to/need to).

I also have a couple of live demos up here:

Keep your eyes peeled for more ColdExt related posts to follow shortly...