ColdFusion 8 Ajax UI Controls: Refresh active tab???????

Where are you?

I’ve tried numerous things to get the tab to refresh. First off I was looking at Ext 2.0 docs but I didn’t realize it until I did a dump on the _ColdFusion.Layout.getTabLayout(“tabs”).getActiveTab()_ and noticed a method not mentioned on the docs. Oops…my bad! 😉

So…instead of just bashing CF8’s attempt at UI Controls via Ajax I figured I’d ask anyone listening.

bq. How do you refresh the active tab dynamically?

Before you answer, let me clarify. I have N number of tabs and inside this particular tab I open a _CFWindow_ (a few gripes about this too) which does some updating and when done I need the selected tab to refresh the contents so it properly shows the latest and greatest info.

Here is what I found to work (and all that worked):

bq. function refreshActiveTab(){
var activeID = ColdFusion.Layout.getTabLayout(“tabs”).getActiveTab().id;
ColdFusion.Layout.hideTab(“tabs”, activeID);
ColdFusion.Layout.showTab(“tabs”, activeID);
ColdFusion.Layout.selectTab(“tabs”, activeID);
return;
}

That’s quite a sucky way to do it, IMO. The user doesn’t see the hide/show…at least in FF. In IE7 the modal background has no alpha (which looks crappy) so I can’t see it anyway.

Either way, after my trials tonight it merely validates my thoughts on CF’s Ajax UI Controls: they need a lot of work! I’ll rant later but the CF Ajax binding is SWEET (lacking a couple things but still sweet). I just want to see the UI controls come up to a really professional level.
</partialRant>

Binding a cfselect to a cfgrid

I had some problems with this because I’m so used to using datagrids in Flash and they work a bit different. First, there aren’t a ton of resources out there about binding a cfgrid to a cfselect. I looked and looked but I shouldn’t have since the reason my initial statements weren’t working is because I treated the cfgrid like a Flash datagrid. So, let’s get into it.

Binding a cfselect to a grid is as simple as this:

bq. <cfgrid name=”mygrid” format=”html” query=”somequery” />
<cfselect name=”myselect” bind=”cfc:somecfc.someMethod({mygrid.id})” bindonload=”yes” … />

That’s it. What happens here is the _bind_ attribute sets the bind to my _somecfc_ cfc’s _someMethod()_ function and passes in the _id_ value from _mygrid_. Nothing special here.

So, why did I have problems? Well, I didn’t let the query create my columns. I created them. Let’s take a look at this again.

bq. <cfgrid name=”mygrid” format=”html” query=”somequery”>
<cfgridcolumn header=”Name” name=”name” />
<cfgridcolumn header=”Some Column” name=”somecolumn” />
<cfgridcolumn header=”Birthday” name=”birthday” />
</cfgrid>

<cfselect name=”myselect” bind=”cfc:somecfc.someMethod({mygrid.id})” bindonload=”yes” … />

The difference here is the _cfgridcolumn_’s specify what columns are shown. The first example will show all of the columns in the grid. This grid (the second example) shows only the _name_, _somecolumn_, and _birthday_ columns. Any other columns are not available.

This _cfselect_ bind will not work. The problem is there is no such column named _id_. BUT THE QUERY HAS AN _id_ COLUMN…WHY ISN’T IT INCLUDED? I’m glad you asked.

If you do not specifically specify a _cfgridcolumn_ the value will not be included. When you think about it…this is pretty cool. Think of a query with 20 columns. I wouldn’t want a grid to have to manage 20 columns if all I want to show are three of them. It is annoying but it works.

So, the working example would be:

bq. bq. <cfgrid name=”mygrid” format=”html” query=”somequery”>
<cfgridcolumn header=”id” name=”id” display=”no” />
<cfgridcolumn header=”Name” name=”name” />
<cfgridcolumn header=”Some Column” name=”somecolumn” />
<cfgridcolumn header=”Birthday” name=”birthday” />
</cfgrid>

<cfselect name=”myselect” bind=”cfc:somecfc.someMethod({mygrid.id})” bindonload=”yes” … />

Notice the _cfgridcolumn_ with the name _id_. The attribute _display_ is set to _no_ so it will not show up in the grid. Now the _cfselect_’s binding will work properly.

I searched the WHOLE INTERNET for this solution and didn’t find it. I saw an example with the same binding as I was using, _mygrid.somecolumn_, but it wouldn’t work for me. At least I have the solution now. I guess I should have read the manual. 🙂

Hope this helps someone.

CF AIR Compiler

Terrence Ryan has a proof of concept app (“CF AIR Compiler”:http://www.numtopia.com/terry/blog/archives/2007/11/cf_air_compiler.cfm) which takes CF sites and compiles them into AIR apps. His approach simply makes since and CF is probably the easiest language to accomplish this since CFHTTP and CFFILE are so freaking simple to use.

Although this is done with CF, for CF, and by CF (I only…with and by are the same thing but i had to complete the phrase; hehe) you could essentially point this to almost any site and pull the files (html content, js, and css) but it is cool to see this proof of concept in the wild.

FAQ-U: ColdFusion 8 .NET Integration

I’m working on an article for “Fusion Authority Quarterly Update”:http://www.fusionauthority.com/quarterly/ on ColdFusion 8 .NET Integration (draft due tomorrow) and I’m pretty impressed by the integration. My only desire is to see CF come up a little more in the area of what it can do (basically nix some of the can’t do’s) and debugging. I’d love to see the next version allow us to control a little more, natively convert more data types, etc, etc, etc.

So, is there anything specific you’d like to see in the article or in the next release of ColdFusion? If time doesn’t exist to get it into the article, I’ll do my best to answer it here.

More to come…

CFWACK 8 Volume 1 Site and Forums

I’m a day late but Volume 1 was released yesterday. “Ray Camden”:http://www.coldfusionjedi.com/index.cfm/2007/9/11/CFWACK-8-Volume-1-Site-and-Forums-and-sample-chapters blogged about it so I figured I’d propagate the word.

CF8 Cumulative HotFix 1 & CF7 CHF3

“Sarge posted this”:http://www.sargeway.com/blog/index.cfm/2007/9/10/ColdFusion-CF8-CHF1-and-CFMX702-CHF3-released earlier so I thought I’d help spread the word.

I love how Adobe took notice and immediately posted an update. That kind of makes me feel even better about the future of CF.

CFWACK for ColdFusion 8 – Book 2, Chapter 32

WACK on Amazon.JPG

Notice something interesting highlighted in yellow? 🙂

That’s right…I’m a co-author of the upcoming ColdFusion 8 Web Application Construction Kit, Volume 2: Application Development. I’ve been holding out on talking about it until I turned in my chapter (which was a little late; writing for a book is tougher than a 3 page article) but now that the chapter is in I’m fine with speaking about it. 🙂

Anyways…give me some time and I’ll start posting some more info on the chapter (Chapter 32 – Working with PDF Files; without giving away the goods). Use the link below to buy any one of the 3 books and make me some money while you’re at it. 😉

**Book 1**
**Book 2**
**Book 3**

I want to thank “Ben”:http://www.forta.com, “Sarge”:http://www.sargeway.com/blog, and “Ray Camden”:http://www.coldfusionjedi.com for helping out, being sounding boards, and (Ben) cracking the whip (at times). 🙂 It was a pleasure. I can’t wait to finalize the tech review changes and see the book in person.