Opened 11 years ago

Closed 7 years ago

#13953 closed defect (wontfix) bug?

Reported by: rmaccracken Owned by: Kris Zyp
Priority: high Milestone: 1.11
Component: Data Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:


I'm using the new api for the first time and trying to create a store that does a single request to the server and fills up a with the response. From then on it just works like a regular memory store. This is used to feed a dijit.form.FilteringSelect? with a page size of 20. I wrap the store using

So the first time the "query" function is called, I return the following:


In, it then has the following code that gets run when a deferred is passed to it: = dojo.when(results, function(results){
        return results.length;

When the deferred is resolved with the final results, results.length is equal to the page size of 20 after the query is processed. However, I have also set to be the true total of all the items now in the store - say 240. So what happens in this case is that is set to 20 rather than 240.

This causes a problem downstream in where there is the following code (the outermost "results" is referring to the deferred):

    dojo.when(, function(totalCount){
        dojo.when(results, function(results){
      , totalCount || results.length, args);

So onBegin is then called with a value of 20 rather than 240, and thus the FilteringSelect? does not show the Previous/More? choices options.

So here is my question: should the code above be changed to the following? = dojo.when(results, function(results){
        return || results.length;

You can reproduce the problem at Just press on the drop-down arrow and you will see 20 results with no option for "More choices", even though there are 25 options in all.

If you type "opt" in the select control, then you will get 20 options with the "More choices" option. So once the initial deferred is resolved, it works as expected.

Change History (3)

comment:1 Changed 11 years ago by Kris Zyp

The assignment only happens if is not there. Is there any reason you can't assign a "total" property with a deferred value that resolves to the total number of items (240) in your query method?

comment:2 in reply to:  1 Changed 11 years ago by rmaccracken

I guess I didn't think of it that way, but that could be done. I just assumed that needed to be a number, but now that you mention it, I guess it could be another Deferred. This seems a bit more complicated though having to track multiple Deferreds.

I still think my initial fix is valid though since the result of dojo.query is supposed to have a "total" property. So when results is an array rather than a Deferred, results.length is not necessarily the appropriate total count.

comment:3 Changed 7 years ago by dylan

Milestone: tbd1.11
Resolution: wontfix
Status: newclosed

I think a number of patterns have emerged around this that are widely accepted now, so closing this as wont fix.

Note: See TracTickets for help on using tickets.