Opened 10 years ago

Closed 10 years ago

#14928 closed defect (duplicate)

returning store.query results and (dgrid and custom store related)

Reported by: teslan Owned by:
Priority: undecided Milestone: tbd
Component: General Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:


Relevant code in original dojo/store/JsonRest.js looks like this:

var results = xhr("GET", {

url: + (query

handleAs: "json", headers: headers

}); = results.then(function(){

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

}); return QueryResults?(results);

I tried all sorts of variations of this:

var results = xhr("GET", {

url: + (query

handleAs: "json", headers: headers


results = results.then(function(response){

var r = response.rows; = response.total_rows; return r;

}); return QueryResults?(results);

In the origial, results are returned as is and in my case it is results.rows that need to be returned.

Now, as soon as I do that, either does not end up being returned as "promised" or as I suspect dgrid is not using the promised value and is instead using either the results.length or worse the default value of 25.

While I am personally new to JS and much of web dev, half a dozen folks on #dojo have tried to help. Out of numerous tests that exist and as I was told work ;) I am still not able to identify any that work with async (xhr like) store.

I need to get this to work in original JsonRest?.js + above changes - to see paging work with an async store. Then I need to replace xhr with io.script , for a stripped down JSONP version. But in all those cases results.child.array needs to be returned to dgrid, as well as an indication of how many records are available to the query, so that dgrid will know to call store.query for more data (I hope).

working non-working demo is available here

17 rows in viewport 25 rows returned 79 rows available and should be reported by

slidebar should be about 1/5 of viewport height (17 / 79) it should not be more than half or 17 / 25

I also created an issue here:

I have applied and tried Ken's suggestion and he's agreed that the problem still exists but he closed that issue as it's highly unlikely to be dgrid related , other than it just happened to be a consumer that I happened to be using.

P.S. It's my first ticket ever, so hopefully I am following the process at least somewhat and filing this in the right place.

Change History (1)

comment:1 Changed 10 years ago by ben hockey

Resolution: duplicate
Status: newclosed

Duplicate of #14930.

Note: See TracTickets for help on using tickets.