我正在使用extjs 4.0.7。我有一个要求,其中在网格的编辑模式下有两个组合框,我需要根据第一个选择的值更改第二个数据。如何根据extjs中选择的其他数据更改组合中的数据4
我正在使用MVC体系结构extjs和返回json字符串来填充组合框中的数据的java代码。我的第一个组合框的代码是:
视图文件:
items: [{
id: 'country',
header: 'Countries',
field: {
xtype: 'combo',
store: [
["USA","USA"],
["India","India"],
],
editable: false,
allowBlank: false,
listeners: {
select: function(combo, records, eOpts){
contactTypeGrid = combo.getValue();
myGrid.fireEvent('LoadStateOnSelect');
}
}
}
},
{
id: 'states',
header: 'Sates',
dataIndex: 'states',
field: {
xtype: 'combo',
store: 'StateStore',
valueField: 'stateDesc',
displayField: 'stateText',
}
}, ....
]
控制器:
LoadStateOnSelect: function(){
contactTypeGrid = contactTypeGrid.toLowerCase();
var stateStore = this.getStateStoreStore();
stateStore.getProxy().url = "myURL.do";
stateStore.getProxy().extraParams.act = contactTypeGrid;
stateStore.load();
},
然而,当我运行此代码,在后台的第二家店的数据变化但是加载掩码继续出现在前面,因此我无法选择任何值。
我该如何解决联合数据加载问题?任何帮助都感激不尽。
谢谢你的答案阿伦。 store.clearValue()不是一个方法,但是,我试过store.removeAll(),但它没有帮助。 调试时使用萤火虫,我注意到当我在国家组合中进行我的第一次选择并按下触发器的状态时,会触发一个请求并完成数值加载。但是,当我第二次重复该过程时,不会触发新的请求,但状态中的数据会更改并显示“加载”蒙版。 这是什么意思? – Merc
我的坏。 store.clearValue()不是一个方法,但是,componentReference.clearValue()存在。我试过,但即使这并没有帮助。 – Merc
我试图重现这一点,但是当用新数据重新加载商店时,我没有任何问题。 –