Javascript Extjs存储不加载数据
你好,我有一个绑定到组合框的商店。当我向组合框添加值时,它开始加载数据。响应中正确返回所有json数据,但没有加载要存储的记录。有什么建议吗 我的商店看起来像: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
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属性来正确显示字段值