Reputation: 507
I have an OnDemandGrid setup to display product data (called parts) for a project i am working on. I currently have only two entries in the product database.
My OnDemandGrid is setup with only the basic options: store, and columns. I am hoping it will be a virtual scrolling grid. the store was setup as a JsonRest store, with Cache
what happens when i open up the page and startup the grid is, the grid keeps sending requests to the server for data continuously - approximately 2 requests per second.
I also realize that for a grid with only two rows, it has a scrollbar on the right. when i try to use this scrollbar to scroll, I find that the grid seems to flicker and reset itself. many times.
I suspect the virtual scroll feature is doing something funky, somehow not acknowledging that there are only two entries. can some one help me out in this? am willing to provide more details should that be necessary.
Here is my code by the way:
require(["dgrid/OnDemandGrid", "dojo/store/Memory", "dojo/store/Cache"], function(OnDemandGrid, Memory, Cache){
var partsCache = new Memory();
App.Store.parts = new Cache(partsMaster, partsCache);
var grid = new OnDemandGrid({
store: App.Store.parts,
columns: {
name:'Part Name',
part_no:'Part Number'
},
}, "grid");
grid.startup();
})
partsMaster is a JsonRest store defined earlier (global at the moment - taking the grid for a spin) in the code. I've done some tests to safely determine that JsonRest is not the issue.
here is a screenshot of the grid currently (note the existence of the scrollbar):
Any help is appreciated!
EDIT: attached is a screen shot of the first request response header from chrome:
Upvotes: 0
Views: 856
Reputation: 10559
Based on the screenshot it looks like your response is not including the Content-Range header, which is what dojo/store/JsonRest
uses to inform itself of the total number of results in the set. While I'm not sure that alone will cause your infinite-querying problem, it will definitely cause a problem.
The Content-Range header should look like e.g. Content-Range: items 0-24/500
(assuming 500 was the total number of items in the result set).
See http://dojotoolkit.org/reference-guide/1.9/quickstart/rest.html for more information on how JsonRest expects services to behave.
If this doesn't completely solve the problem, I'd also be curious to verify that the response body is indeed yielding the correct subset of results.
Edit: based on interaction I had on a dgrid issue today, the issue could be that your service is actually returning the incorrect number of results based on the query. See these comments on #691.
Upvotes: 1