FilteringSelect paging using a JsonRest store in Dojo 1.7

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FilteringSelect paging using a JsonRest store in Dojo 1.7

James Shaw
I'm trying to page results within a dijit.form.FilteringSelect that runs off a dojo.store.JsonRest store. The server receives the range header, parses it and returns the correct number of results accordingly, along with the Content-Range header in the format "items [start]-[end]/[total]". However, the range doesn't appear to be being used as if the pageSize is a factor of the total number of results, the last page still shows the 'More Choices' option. A bit of investigation has shown that within dojo.store.JsonRest.query, the

results.total = results.then(function(){
    var range = results.ioArgs.xhr.getResponseHeader("Content-Range");
    return range && (range=range.match(/\/(.*)/)) && +range[1];
});

block appears to parse the Content-Range header correctly, however the returned value isn't being assigned to results.total, with it being assigned the Deferred object instead. Subsequently, results.total is not set to properly work with the following conditional in dijit.form._ComboBoxMenuMixin.createOptions:

// Try to determine if we should show 'more'...
if(results.total && !results.total.then && results.total != -1){

That condition fails, with results.total.then existing as a function stub, and the else is hit, resulting in the length of the results list being compared to the pageSize. Which means the results are paged properly until the last page is reached when it will show 'More Options' if exactly the same amount of results are returned as the pageSize.

Can't help but feel I'm missing something...
Reply | Threaded
Open this post in threaded view
|

Re: FilteringSelect paging using a JsonRest store in Dojo 1.7

PaulChristopher
James,

I think this is a bug and I have reported it on the bug tracker, see http://bugs.dojotoolkit.org/ticket/14895.

Does the FilteringSelect work for you with Opera browsers? I do not get a range header on the sever side. It's simply missing. It works fine with Firefox10, IE9, Safari5.

I need to debug this so as to figure out whether this is Dojo or my ASP.net which make the HTTP-Header loose the range header.

How does it behave in your app? Does the FilteringSelect work for you when used within an Opera browser?

Reply | Threaded
Open this post in threaded view
|

Re: FilteringSelect paging using a JsonRest store in Dojo 1.7

James Shaw
Thanks for looking into it Paul.

Like you, I don't see a range header server side when using Opera. And resultantly, paging doesn't work, with the full result set being shown within the FilteringSelect.

Apart from the original 'last page, more options' bug, it works fine with all other browsers in which I've tested (FF9+10, IE 8+9, Chrome - don't keep on top of which version of Chrome is in use at any given time, but 'the last few' should cover it).
Reply | Threaded
Open this post in threaded view
|

Re: FilteringSelect paging using a JsonRest store in Dojo 1.7

PaulChristopher
What server side technology do you use? ASP.net? JavaEE? Other?

Do you think, this is a Dojo bug, too?

I have problems debugging my app with Fiddler2: Fiddler does not pick up the traffic from Opera to Cassini for some unknown reason (whereas debugging in IE works like a charm).
Reply | Threaded
Open this post in threaded view
|

Re: FilteringSelect paging using a JsonRest store in Dojo 1.7

James Shaw
Using PHP5 on the server.

It definitely looks like a bug within Dojo as I can't see what I'm doing wrong (that sounds a bit arrogant; it's not supposed to) having gone through both the documentation and the code, and the values returned from the server are as I'd expect them to be.
Reply | Threaded
Open this post in threaded view
|

Re: FilteringSelect paging using a JsonRest store in Dojo 1.7

enez
This post has NOT been accepted by the mailing list yet.
This post was updated on .
And what was solution? I could not find that mixin file in dojo. Same problem with same components. I was trying with 1.7.2 and 1.7.3 versions.