Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9556 closed defect (fixed)

ClientFilter miscalculates the total length of a result set when a Grid requests the last "page" of results

Reported by: dstarke Owned by: Kris Zyp
Priority: high Milestone: 1.4
Component: DojoX Data Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description

When I use ClientFilter? and a PersevereStore? as the backing store for a DataGrid?, I find that when I scroll to the end of the grid, all the data rows except the first few rows are deleted from the grid.

Investingating this, I found that ClientFilter? contains the following code to calculate the total length of a result set:

if(!args.count
results.length < args.count){

defResult.fullLength = results.length;

}

The reason this does not work is that the DataGrid? always requests a number of records equal to the page size, regardless of whether there are less than that many rows remaining to retrieve.

In this case, args.count was 25 (the page size) and results.length was a number smaller than 25 (for example, 8). However, this was because the request also contained a start parameter (for example, 50) because this request was for the last page of data. As a result, defResult gets rewritten from what it should be (58) to 8, and the grid then truncates the data displayed.

The calculation above needs to take the start parameter into effect to work correctly. The following line of code (replacing the middle line above) resolved the issue in my environment:

defResult.fullLength = ((args.start)?args.start:0) + results.length;

Alternatively, the DataGrid? could be modified to make sure that it only requests the number or records that it knows exists in the store, but this may be more complicated to implement correctly.

Change History (3)

comment:1 Changed 10 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

comment:2 Changed 10 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

comment:3 Changed 10 years ago by Kris Zyp

Milestone: tbd1.4
Note: See TracTickets for help on using tickets.