通过服务调用获取数据时extjs存储区收集不工作
我正在使用ext4。我必须使用存储中的数据填充具有不同值的四个组合框。 但在存储上使用collect方法时,它给出了空数组。当存储中有静态数据时,它可以工作,但当使用存储中的代理获取数据时,它不工作通过服务调用获取数据时extjs存储区收集不工作,extjs,Extjs,我正在使用ext4。我必须使用存储中的数据填充具有不同值的四个组合框。 但在存储上使用collect方法时,它给出了空数组。当存储中有静态数据时,它可以工作,但当使用存储中的代理获取数据时,它不工作 /* inside view */ initComponent: function() { console.log('inside menu Panel '); var me = this; var filter
/* inside view */
initComponent: function() {
console.log('inside menu Panel ');
var me = this;
var filterCriteriaStore = Ext.create('ITChart.store.StoreForMenu');
Ext.applyIf(me, {
defaults:{
margin:'20 40 20 20'
},
items: [
{
xtype: 'combo',
id: 'territory',
store: filterCriteriaStore.collect('territory'),
displayField: 'territory',
valueField:'territory',
maxWidth:'100',
margin: '20 40 20 0',
value: 'ABC'
},
{
xtype: 'combo',
id: 'content',
store: filterCriteriaStore.collect('content'),
displayField: 'content',
valueField:'content',
maxWidth:'100',
value: 'XYZ'
}
]
});
me.callParent(arguments);
}
/* not working */
/* inside store */
proxy: {
type: 'ajax',
url : 'http://localhost:8080/ServiceName/getFilterCriteriaExt',
reader: {
type: 'json',
root: 'responseDTO'
}/*,
headers: {
'Content-Type': 'application/json; charset=utf-8; Cache-Control: no-cache'
}*/
//actionMethods: 'POST'
},
/* working */
/* inside store */
data : [
{"content":"XYZ","type":"Song","territory":"ABC","payment":"Paid","errorCode":""},{"content":"Music","type":"Album","territory":"ABC","payment":"Paid","errorCode":""},{"content":"XYZ","type":"Song","territory":"IND","payment":"Paid","errorCode":""},
{"content":"Music","type":"Album","territory":"ABC","payment":"Paid","errorCode":""},
{"content":"Movie","type":"Song","territory":"CHINA","payment":"NotPaid","errorCode":""},
{"content":"Music","type":"Song","territory":"IND","payment":"NotPaid","errorCode":""}
]
您确定商店已在该点加载吗?否则,您必须首先加载存储,因为当您定义静态数据时,它不必实际加载
var filterCriteriaStore = Ext.create('ITChart.store.StoreForMenu');
filterCriteriaStore.load();
您好,当我在组合框中使用filterCriteriaStore作为存储时,它工作正常,所有值(重复)都在组合框中,但当我使用filterCriteriaStore.collect(“某些列名”)时,它就不工作了。这是因为组合框将加载存储本身,而您是collect(“…”)函数给出了存储的一个子集,但如果尚未加载,则它将无法工作。调用collect函数时,您是否尝试过查看存储区中的内容?您好,正如您所提到的,我尝试过filterCriteriaStore.load()。我还将商店的自动加载设置为true。