Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Extjs存储不加载数据_Javascript_Extjs_Combobox_Store - Fatal编程技术网

Javascript Extjs存储不加载数据

Javascript Extjs存储不加载数据,javascript,extjs,combobox,store,Javascript,Extjs,Combobox,Store,你好,我有一个绑定到组合框的商店。当我向组合框添加值时,它开始加载数据。响应中正确返回所有json数据,但没有加载要存储的记录。有什么建议吗 我的商店看起来像: CheckersStore = Ext.extend(Ext.data.JsonStore, { constructor : function(cfg) { cfg = cfg || {}; CheckersStore.superclass.constructor.call(this, E

你好,我有一个绑定到组合框的商店。当我向组合框添加值时,它开始加载数据。响应中正确返回所有json数据,但没有加载要存储的记录。有什么建议吗

我的商店看起来像:

    CheckersStore = Ext.extend(Ext.data.JsonStore, {
    constructor : function(cfg) {
        cfg = cfg || {};
        CheckersStore.superclass.constructor.call(this, Ext.apply({
            storeId : 'CheckersStore',
            api :{
                read : 'checker/getPagedList'
            },
            baseParams : {
                organizationId : 0
            },
            idProperty : 'userName',
            fields : [ {
                mapping : 'userName',
                name : 'value'
            }, {
                mapping : 'fullName',
                name : 'label'
            }, {
                name : 'organizationId',
                type : 'int'
            } ]
        }, cfg));
    }
});
new CheckersStore();
{
"start" : 0,
"limit" : 20,
"total" : 48,
"data" : [{
        "userName" : "KUUJOMAR",
        "fullName" : "Kuujo, Marketta Päivi",
        "organizationId" : 108
    }, {
        "userName" : "KUUKKKAL",
        "fullName" : "Kuukka, Kalle",
        "organizationId" : 108
    }
],
"organizationId" : 108
返回的JSON数据如下所示:

    CheckersStore = Ext.extend(Ext.data.JsonStore, {
    constructor : function(cfg) {
        cfg = cfg || {};
        CheckersStore.superclass.constructor.call(this, Ext.apply({
            storeId : 'CheckersStore',
            api :{
                read : 'checker/getPagedList'
            },
            baseParams : {
                organizationId : 0
            },
            idProperty : 'userName',
            fields : [ {
                mapping : 'userName',
                name : 'value'
            }, {
                mapping : 'fullName',
                name : 'label'
            }, {
                name : 'organizationId',
                type : 'int'
            } ]
        }, cfg));
    }
});
new CheckersStore();
{
"start" : 0,
"limit" : 20,
"total" : 48,
"data" : [{
        "userName" : "KUUJOMAR",
        "fullName" : "Kuujo, Marketta Päivi",
        "organizationId" : 108
    }, {
        "userName" : "KUUKKKAL",
        "fullName" : "Kuukka, Kalle",
        "organizationId" : 108
    }
],
"organizationId" : 108
}


即使我只是尝试使用相同的参数调用
store.load()
,也会出现相同的问题。

尝试去掉字段中的
映射属性。然后将
root:'data'
添加到存储
reader

reader: {
    root: 'data',
    type: 'json'
}
以及字段:

fields : [{
    name : 'value'
}, {
    name : 'label'
}, {
    name : 'organizationId',
    type : 'int'
}]

我需要我的惰性加载组合的mapping属性来正确显示字段值