Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14895 closed defect (fixed)

Paging problems with FilteringSelect using a JSON REST store

Reported by: Paul Christopher Owned by: Douglas Hays
Priority: undecided Milestone: 1.8
Component: Dijit - Form Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Description

I have to confirm what has already been pointed out by James Shaw: http://dojo-toolkit.33424.n3.nabble.com/FilteringSelect-paging-using-a-JsonRest-store-in-Dojo-1-7-td3770061.html

The paging functionality for FilteringSelects using JSON REST stores seems to be broken somehow if the total results number is an integral multiple of pageSize. If so, the last page still displays a "More options" link although there are no more options available.

Steps to reproduce the issue

Set up a FilteringSelect which uses a JSON Rest Store as data source. Set the pageSize to e.g. 5. Make sure that a certain query has a total results number of 10, 15 or 20, i.e. total results needs to be an integral multiple of pageSize. Click through the pages. The last page still shows a "More options" link although there are no more options available.

Discussion

The mail by James Shaw gives some information which code parts might cause the problem.

Attachments (1)

14895.patch (2.6 KB) - added by Douglas Hays 7 years ago.
patch to implement nested Deferred.when calls

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Douglas Hays

Component: Dijit - FormData
Owner: changed from Douglas Hays to Kris Zyp

From James Shaw,
... 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. ...

comment:2 Changed 7 years ago by Kris Zyp

Yes, this is correct, the results.total is a deferred object because it is resolved asynchronously.

comment:3 Changed 7 years ago by bill

Component: DataDijit - Form
Owner: changed from Kris Zyp to Douglas Hays

So, I think FilteringSelect needs to handle this using a Deferred.when(total, ...), since total could be a Promise or a scalar value. Guess we also need a test case against JsonStore, probably using a PHP file to serve the requested data.

Changed 7 years ago by Douglas Hays

Attachment: 14895.patch added

patch to implement nested Deferred.when calls

comment:4 Changed 7 years ago by Douglas Hays

Milestone: tbd1.8
Status: newassigned

Paul, can you please try out the attached patch to see if it works for you?

comment:5 Changed 7 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

In [28065]:

Fixes #14895. Handle results.total from dojo.store.query being a Deferred object. Add automated test.

comment:6 Changed 7 years ago by Paul Christopher

Yep, this works for me now. I could not find _SearchMixin.js in Dojo 1.7.2, but could find it in the latest nightly builds. I downloaded the latest builds and it works there. Thanks Doug!

Note: See TracTickets for help on using tickets.