Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8207 closed defect (fixed) doubles "totalCount" in resultset

Reported by: Malte Randt Owned by: Kris Zyp
Priority: high Milestone: 1.3
Component: DojoX Data Version: 1.2.2
Keywords: Cc:
Blocked By: Blocking:


The method _processResults of ServiceStore? doubles the attribute totalCount returned by the service call, if the number of results equals the number of requested results per page.

I do not see a reason for that behaviour, however if there is one I'd be happy to learn about it.

This causes at least two problems:

  • If a widget using the store (for example dojox.DataGrid?) supports paging, an unnecessary request is fired in order to obtain results for the second page - which does not exist.
  • If the service does not support paging (i.e. it will ignore paging parameters and just retransmit the same data as before), phantom results will be shown.

I can reproduce this with dojo 1.2.0 through 1.2.2.

The problem seems to be located in file dojox/data/ServiceStore.js, lines 231-232:

var count = results.length;
return {totalCount: deferred.request.count == count ? count * 2 : count, items: results};

Change History (5)

comment:1 Changed 13 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to kriszyp

Chris, any idea? I believe you authored this store.

comment:2 Changed 13 years ago by dante

Owner: changed from kriszyp to Kris Zyp

comment:3 Changed 13 years ago by Kris Zyp

This was by design because by default ServiceStore? does not have any mechanism for a response to signal the total count, therefore the current count is used as the estimate for the total count. This works well with services that do support paging (the "phantom" requests are rare, so have little impact on performance). However, you are correct that it is problematic for services that do not support paging. I will add an option to control this behavior (estimateCount).

comment:4 Changed 13 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [16377]) Fixes #8207, adding an estimateCountFactor parameter to control total count estimation

comment:5 Changed 13 years ago by Adam Peller

Milestone: tbd1.3

batch move of tickets marked 'tbd' fixed in the 1.3 timeframe

Note: See TracTickets for help on using tickets.