Javascript 带有JsonRestStore的响应头(带有Dgrid/Dojo)

Javascript 带有JsonRestStore的响应头(带有Dgrid/Dojo),javascript,dojo,dgrid,Javascript,Dojo,Dgrid,试图用我的json存储构建一个动态网格,但由于某种原因存在范围限制,我想这是dgrid/store实现的一部分,但我应该向下滚动我的网格,从dgrid站点的示例中获得更多结果 我会在这里输入一些代码。首先,我尝试在代码中非常模块化,因此我有一个获取我的存储的文件(content.js),一个构建我的网格的文件(gridlayout.js)和main.js(创建我的实例并传递我的存储) content.js define([ "dojo/_base/xhr", "dojo/sto

试图用我的json存储构建一个动态网格,但由于某种原因存在范围限制,我想这是dgrid/store实现的一部分,但我应该向下滚动我的网格,从dgrid站点的示例中获得更多结果

我会在这里输入一些代码。首先,我尝试在代码中非常模块化,因此我有一个获取我的存储的文件(content.js),一个构建我的网格的文件(gridlayout.js)和main.js(创建我的实例并传递我的存储)

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;
});
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"
    },

    });
});
GridLayout.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;
});
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个结果,如果向下滚动,我将无法获得其余项目。

浏览器中的答案显示项目0-24/25。这意味着服务器端的项目总数是25。因此,网格不会试图获取更多

如果它返回0-24/1000,则在滚动时会有多个调用

因此,我认为您应该检查服务器端,为什么它只返回25个项目的总数


选中此项:

浏览器中的答案显示项目0-24/25。这意味着服务器端的项目总数是25。因此,网格不会试图获取更多

如果它返回0-24/1000,则在滚动时会有多个调用

因此,我认为您应该检查服务器端,为什么它只返回25个项目的总数


检查此项:

服务器端有多少项?服务器端有多少项?嗯。。不是真正的服务器端,更多的是关于请求。检查请求标题。@fn服务器应返回最大项数-检查此项:ohhhh。。。因此,我确实需要将其设置为max/total。好的,修复了响应标题,我得到了我的项目总数。但是当我用dgrid向下滚动时,没有调用任何函数来呈现新项目?我在chrome中的控制台上得到这个错误:拒绝获取不安全的标题“Content Range”hmmm。。不是真正的服务器端,更多的是关于请求。检查请求标题。@fn服务器应返回最大项数-检查此项:ohhhh。。。因此,我确实需要将其设置为max/total。好的,修复了响应标题,我得到了我的项目总数。但是当我用dgrid向下滚动时,没有调用任何函数来呈现新项目?我在chrome中的控制台上得到这个错误:拒绝获取不安全的标题“内容范围”