Reputation: 1087
Trying to build a dynamic grid with my json store, but for some reason there's a range constraint and I guess it's part of the dgrid/store implementation, but I should scroll down my grid and get more result from the example at dgrid site.
I'll put some code in here. First, I tried to be very modular in my code, so I have a file that gets my store (content.js), a file that build my grid (gridlayout.js) and main.js (create my instance and pass my store).
content.js
define([
"dojo/_base/xhr",
"dojo/store/Memory",
"dojo/store/JsonRest",
"dojo/store/Cache"
],
function(
xhr,
Memory,
JsonRest,
Cache
){
var contentMemoryStore = new Memory();
var contentJsonRestStore = new JsonRest({target: "http://dev.mpact.tv:30087/rest/contenus/"});
contentStore = new Cache(contentJsonRestStore, contentMemoryStore);
return contentStore;
});
GridLayout.js
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dgrid/OnDemandGrid",
"dgrid/Keyboard",
"dgrid/Selection",
"dgrid/extensions/ColumnHider",
"dgrid/editor",
], function(
declare,
_WidgetBase,
Grid,
Keyboard,
Selection,
Hider,
editor
){
return declare([Grid, Keyboard, Selection, Hider], {
columns: {
selected: editor({
label: " ",
autoSave: true,
sortable: false
}, "checkbox"),
nom: "Name",
autodelete: "Auto-delete",
groupe_id: "Groupe ID",
global: "Global",
date: "Date",
duree: "Lenght",
description: "Description",
fichier: "Filename",
pleinecran: "Fullscreen",
repertoire: "Folder",
taille: "Size",
expiration: "Expired",
id: "id",
catergorie: "Category",
brouillon: "Example"
},
});
});
and my main.js:
var gridLayout = new GridLayout({}, "placeholder");
gridLayout.set("store", contentStore);
So far, I just 25 result and if I scroll down, I don't get the rest of my items.
Upvotes: 1
Views: 1960
Reputation: 5010
The answer in your browser shows items 0-24/25. That means the total number of items server side is 25. Hence the grid won't try to fetch more than that.
If it were returning 0-24/1000, then there would be multiple calls when you would scroll.
So I think you should check server side why it only returns 25 as total number of items.
Check this: http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html#id7
Upvotes: 1