Reputation: 1
When scrolling the grid, it does not fire a new request for more items when you reach the end of the 20 items
I am using Dojo version 1.10.4. I created a TrackableRest Store
var TrackableRest = declare([Rest, Trackable]);
var interceptStore = new TrackableRest({
target: 'rest/intercepts/',
accepts: "application/json",
sortParam: 'sort',
rangeStartParam: 'offset',
rangeCountParam: 'limit',
headers:{
'Accept': "application/json",
'Content-Type':"application/json",
'charset':"UTF-8"
},
idProperty: 'id'
});
Then I created a grid:
var grid = window.grid = new CustomGrid({
id: 'grid',
//sort: [{property:'ELNOT'},{property:'RF_AVG'}], // Initialize sort on last name, ascending
collection: interceptsStore,
sort: "id",
getBeforePut: false,
columns: getColumns(),
allowSelectAll: true,
loadingMessage: 'Loading data...',
noDataMessage: 'No results found.',
title: "All",
minRowsPerPage: 20,
maxRowsPerPage: 250
});
The request is sent http://localhost:8080/OlympiaMap/rest/intercepts/?sort=+id&offset=0&limit=20
And the response includes the header Content-Range with a value of items=0-20/606 and the data looks like enter image description here
Upvotes: 0
Views: 154
Reputation: 1
So after two days of waiting I realized that even though you return the Content Header in the desired format it appears that it is using the values in your response total, limit and offset (or whatever you choose for your start and count params). For instance, in my response headers I returned Content-Range with a value of "items 0-20/606" but in the actual response I have a items array with 20 items and a total of 20. When I hard coded this valued (just to test) to match the 606 value I started to see the virtual scrolling work and send request incrementing the start and count. Like this 1st on page load http://localhost:8080/OlympiaMap/rest/intercepts/?sort=+id&offset=0&limit=20
While scrolling http://localhost:8080/OlympiaMap/rest/intercepts/?sort=+id&offset=20&limit=20
etc and so on
This is due to a lack of documentation on part of the dstore and dgrid
Upvotes: 0