AJAX - A battle between Spry and CF8 built in facilities
I have been working on a new project which requires AJAX functionality and unlike some projects have some more time available to try out alternate ideas. The result has been interesting, so I thought I would share it.
There are a number of pieces of funcionality planned and in almost every case there has been a choice of using a CF function or a Spry equivalent and I have come down in favour of the Spry equivalent.
Tabbed Panels
The first situation was a need to define a tabbed panel. Clicking on a tab to change the panel contents. Easy in CF8 so that was my first choice but the shape and format of the tab made it difficult to do in CF8. So Iasked my designer if he was happy to let me use the CF8 version. Well he wasn't so I asked him to see if he could find a way to change the CF8 tabs.
After a shoort while he came back with a Spry version of the page courtesy of Dreamweaver CS3. The Spry version has all the look and feel that the designer wanted and will work very well in CF.
Datasets
I had in mind to use the new AJAX based grid control to display the output on a number of pages in the new application. One thing bothered me though. When I resize the page the width of the gid does not resize and needs horizontal scrolling. Yuk!My designer was all fired up with the earlier sucess with Spry and went away to see what DW would do with it. After a while a much better looking page came back with Spry datasets. He has taken an HTML table as input, converted it to a spry dataset and displayed it as a sortable grid. Not editable, but actually we don't need that functionality on this page. Since he had full control of the HTML and CSS he also did a greatjob of making it look good.
The only problem here is that the HTML table is a bit limiting in how it works. I have to convert it to use JSON to keep the page weight down.
OK so at last CF8 will help me! Won't it?
I can use the new CF8 JSON functionality to make my JSON.
This is where I get stuck. Although CFCs can create JSON directly through the use of the
The format is wrong to drive Spry. Spry datasets expect an array with structures for each row and the CFC returns a structure of arrays. That what the EXT grid built into CF8 uses. I tried the CF Function SerializeJSON and that did the same.
Luckily I found a posting by Ben Nadel which explained it and had some code to fix that.
Ben's ToJavascript function is based on CFJASON and does the serialisation the other way round which suits spry much better.
RTFM
I just noticed however that in the CF8 Manual there is an additional attribute available on SerializeJSON. The attribute is serializeQueryByColumns and the maula says if you use that you can change the format. I haven't tried it yet but I wish I had read the manual earlier.
I'll post more when I have the problem completly solved.

There are no comments for this entry.
[Add Comment]