我是js
和ExtJS 3.4的初学者,我正在尝试在Ext.window中使用Ext.form.ComboBox
来显示js
个对象(图层)的列表。
问题是当我第一次创建窗口并单击combobox
触发器时,我正确地获取了图层列表,但是当我删除或添加图层并再次单击触发器时,商店不会没有更新,我找到了相同的列表。
您能否帮我找到解决此问题的方法,例如当我点击触发器时它会更新并加载新的列表存储?
欢迎提出任何建议。
CODE SNIPPET
// The "ImageField" is an item witch is called on the return of the methode "createWindow" ...
createWindow: function() {
ImageField = new Ext.form.ComboBox(Ext.apply({
name: "Image_ref",
fieldLabel: "Image Input (Required)",
emptyText: "Select your Image",
xtype: 'combo',
forceSelection: true,
editable: true,
allowBlank: true,
triggerAction: 'all',
mode: 'local',
valueField: 'value',
displayField: 'text',
labelWidth: 300
width: 250,
id: 'myCombo',
hideLabel: false,
lazyRender: false,
lazyInit: false,
mode: 'local',
triggerAction: 'all',
store: new Ext.data.SimpleStore({
autoLoad: true,
autoDestroy: true,
fields: ['text', 'value'],
data: layer_liste_WCS // is a liste of js objects
}),
listeners: {
beforequery: function(qe) {
// console.log(qe);
qe.cancel = true;
addComboxFieldItemsWCS(); // Run this methode to get "layer_liste_WCS" witch is liste of data
var actionComboBox = Ext.getCmp('myCombo');
.
.
.
.
.
.
// I don't know how to do to reload the store after runing the methode "addComboxFieldItemsWCS"
}
}
}, base));
return new Ext.Window({
closable: true,
resizable: false,
shadow: false,
closeAction: 'hide',
region: "center", //"north","south","east","west"
width: 480,
height: 190,
iconCls: 'wind_icon',
plain: true,
layout: 'border',
buttonAlign: 'right',
layout: 'fit',
listeners: {
show: function() {
this.el.setStyle('left', '');
this.el.setStyle('top', '');
}
},
items: [{
region: 'center',
xtype: 'tabpanel',
activeTab: 0,
width: 50,
height: 20,
items: [{ // we will declare 3 tabs
title: 'Datas Inputs',
closable: false,
iconCls: 'input_icon',
active: true,
items: [{
xtype: 'form',
autoWidth: true,
labelWidth: 185,
bodyStyle: "padding:10px;",
items: [
ImageField,
]
}]
}]
}],
});
},
答案 0 :(得分:0)
我迟到了,但我抓住了机会。
你在addComboxFieldItemsWCS
中有一个ajax电话吗?
如果可以,请将此代码放在回调中:
Ext.getCmp('myCombo').getStore().loadData(layer_liste_WCS, false);
有关您的信息,false参数是替换现有数据。
希望得到这个帮助。