尝试使用我的 json 存储构建动态网格,但由于某种原因存在范围限制,我猜它是 dgrid/store 实现的一部分,但我应该向下滚动网格并从 dgrid 站点的示例中获得更多结果。
我会在这里放一些代码。首先,我试图在我的代码中非常模块化,所以我有一个获取我的商店 (content.js) 的文件,一个构建我的网格 (gridlayout.js) 和 main.js 的文件(创建我的实例并传递我的商店)。
内容.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"
},
});
});
和我的main.js:
var gridLayout = new GridLayout({}, "placeholder");
gridLayout.set("store", contentStore);
到目前为止,我只有 25 个结果,如果我向下滚动,我不会得到其余的项目。