SitePen/dgrid — Issue #54: Loading problem with JsonRest store with paging
Author: mchamplain
Created: 2011-12-05 16:15:04+00:00
State: open

**I'm trying to use a OnDemandGrid with a JsonRest store, it works for the first page of data, but when I scroll down to see other results, I see that another call is made to the server with a different range, but the grid is not updating correctly. Server side I return the Range-Content as described in the documentation.**

**JS code:**

```javascript
require([
"dgrid/OnDemandGrid",
"dojo/_base/declare",
"dojo/store/JsonRest",
"dojo/store/Cache",
"dojo/store/Memory",

"dojo",
"dojo/domReady!"
],
function(Grid, declare, JsonRest, Cache, Memory){

//	define the column structure on the main grid, and create it.
var columns = [
{
label: 'Id',
field: 'id'
},
{
label: 'Name',
field: 'name'
}
];

var productGroupStore = Cache(JsonRest({target:"/mock/productgroups/"}), Memory());

window.grid = new (declare([Grid]))({
store: productGroupStore,
columns: columns,
minRowsPerPage: 5,
maxRowsPerPage: 5
}, "grid");

}	//	end "main" function
);	//	end require
```

**The json return on the first call to /mock/productgroups/**
[{"id":70926,"name":"Fake Product"},{"id":580689,"name":"Fake Product"},{"id":801159,"name":"Fake Product"},{"id":335780,"name":"Fake Product"},{"id":985208,"name":"Fake Product"}]

**and the headers for that call:**
Status Code:200 OK

Request Headers:
Accept:application/javascript, application/json
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Type:application/x-www-form-urlencoded
Range:items=0-4
X-Requested-With:XMLHttpRequest

Response Headers:
Connection:Keep-Alive
Content-Length:180
Content-Type:text/x-json;charset=UTF-8
Keep-Alive:timeout=15, max=70
cache-control:no-cache
content-range:0-4/500

**And when I scroll the grid to see other results, here's the result:**
[{"id":174082,"name":"Fake Product"},{"id":397380,"name":"Fake Product"},{"id":403586,"name":"Fake Product"},{"id":921312,"name":"Fake Product"},{"id":379202,"name":"Fake Product"}]

**and corresponding headers:**

Request Method:GET
Status Code:200 OK

Request Headers:
Accept:application/javascript, application/json
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Type:application/x-www-form-urlencoded
Range:items=5-9
X-Requested-With:XMLHttpRequest

Response Headers:
Connection:Keep-Alive
Content-Length:181
Content-Type:text/x-json;charset=UTF-8
Keep-Alive:timeout=15, max=62
cache-control:no-cache
content-range:5-9/500