OCTOBER 5 2007

ColdFusion 8: Bug with cfsprydataset and Spry Paged Views

Related Categories: ColdFusion AJAX,

So I'm playing with cfsprydataset and some existing Spry code I had that uses Spry Paged Views. Turns out the Spry.Data.PagedView() cannot bind to dataset created by cfsprydataset. The workaround that I have found is to manually create a Spry dataset with the same name and type used in the cfsprydataset call. This allows the local Spry.Data.PagedView() to bind to the local dataset.

view plain print about
1<cfsprydataset bind="url:datapump.cfc?queryFormat=column&method=getArtists" name="dsArtists" type="json" options="{path: 'DATA', pathIsObjectOfArrays: true}" />
2<script type="text/javascript" src="/CFIDE/scripts/ajax/spry/includes/SpryPagedView.js"></script>
3<script type="text/javascript">
4    //Spry.Data.Region.debug = true;
5    var dsArtists = new Spry.Data.JSONDataSet("datapump.cfc?queryFormat=column&method=getArtists", {path: 'DATA', pathIsObjectOfArrays: true});
6    var pvArtists = new Spry.Data.PagedView(dsArtists, {pageSize: 5});
7    
8    var pageOffset = 0;
9    var pageSize = 5;
10    var pageStop = pageOffset + pageSize;
11    
12</script>

Oddly enough there's only one AJAX call and dataset retrieved. I've attached some code samples that run against the CF8 example database. I've also sent this to the Spry team to see if I'm missing something.

Update: I filed bug 70562 for this issue.

Comments (6) | Print | Send | Download | del.icio.us | Digg It! | Linking Blogs
TweetBacks
There are no TweetBacks for this entry.
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)

[Add Comment] [Subscribe to Comments]

todd sharp's Gravatar I don't get it - If you create the dataset manually why even bother with the cfsprydataset?
# Posted By todd sharp | 10/5/07 2:01 PM
todd sharp's Gravatar Forgot to subscribe.
# Posted By todd sharp | 10/5/07 2:02 PM
Sarge's Gravatar I was attempting to migrate code to using the new tags in CF8 and noticed the paged view breaks without the manual data set. Another reason to use cfsprydataset with your manual JSON data sets is to get passed the meta tag throwing off the JSON. There are several posting about this issue but I've found two ways around it -- stay tuned for that posting.
# Posted By Sarge | 10/5/07 2:19 PM
Cyrill's Gravatar Hi guys
I ran acros the same problem today. Specially when using <cfsprydataset ... > inside a <cflayoutarea ... > with url-binding. After a couple of hours I've found the reason for that behaviour. When loading content asynchrounously using url-bindings, ColdFusion and yui/ext respectively, encapsulate contained scripts into an object. Now, if you define the page view as private variable (by using the var keyword), it is not shared with the main page wehere the Spry-scripts are included. As a result of this, they cannot access the dsArtists / pvArtists object in your example. Just removing the var keyword might help in this case...
Regards, Cyrill
# Posted By Cyrill | 11/9/07 7:11 AM
Werbeagentur's Gravatar Removing the var keyword helped.
# Posted By Werbeagentur | 3/5/08 1:56 AM
Vladi's Gravatar Remove var keyword...that´s is it.
# Posted By Vladi | 6/7/11 6:12 AM
Welcome to Sarge's personal blog A green acorn

Previous Month February 2012 Next Month

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

Subscribe
Enter your email address to subscribe to this blog.