简体   繁体   English

Extjs存储库不加载数据

[英]Extjs store does not load data

Hello i have store which is binded to combo box. 您好我有绑定到组合框的商店。 And when i add value to combo box it starts loading data. 当我向组合框添加值时,它开始加载数据。 All json data is correctly returned in response, but no records are loaded to store. 作为响应,所有json数据均正确返回,但没有记录要存储。 Any suggestions? 有什么建议么?

My store looks like : 我的商店看起来像:

    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();

returned JSON data looks like : 返回的JSON数据如下所示:

{
"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

} }

and even if i just try to call store.load() with same parameters, same problem also appears. 即使我只是尝试使用相同的参数调用store.load() ,也会出现相同的问题。

Try getting rid of the mapping property inside the fields. 尝试摆脱字段内的mapping属性。 Then add root: 'data' inside the stores reader . 然后在商店reader添加root: 'data'

reader: {
    root: 'data',
    type: 'json'
}

and the fields: 和字段:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM