View Full Version : Reload a ComboBox store on trigger click Extjs 3.4

9 May 2015, 4:52 AM
I'm a beginner on js and Extjs 3.4, I'm trying to use Ext.form.ComboBox in a Ext.window to show the list of js objects (layers). the problem is when I create the window the first time and I click on the ComboBox trigger I get my layers list correctly, but when I remove or add a layer, and I click again on the trigger the store don't update and I find the same list :((( Can you please help me to find a solution to this problem, for example when I click on the trigger it will update and load the new list store ? Any suggestion is welcome,
Thank you in advance !

// 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",
forceSelection: true,
editable: true,
allowBlank: true,
triggerAction: 'all',
mode: 'local',
valueField: 'value',
displayField: 'text',
labelWidth: 300
width: 250,
id: 'myCombo',
hideLabel: 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

beforequery:function(qe) {
// console.log(qe);
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,
items: [{ // we will declare 3 tabs
title: 'Datas Inputs',
iconCls: 'input_icon',
active: true,
xtype: 'form',
autoWidth: true,
labelWidth: 185,
bodyStyle: "padding:10px;",
items: [

11 May 2015, 11:58 AM
Can you provide more detail on what your code is doing, such as the add/remove functionality? If you can provide this in a fiddle (https://fiddle.sencha.com) I can help you troubleshoot easier.

11 May 2015, 12:55 PM
I'm so bad to make it work on the fiddle, it may take me a lot of time :( To add/remove layers I do it manually from the interface from another panel separately... the code is not connected with the window were is my combobox "ImageField". What I need to know is how can I make a "listeners" or a "ontriggerclick" or some thing else witch can run the "addComboxFieldItemsWCS" method (witch will update the simple store) and to load the new store in my combobox "ImageField" when I click the trigger. If I wasn't be clear, in some specific point fill free to ask me ! Thank you in advance for your help.

25 Dec 2015, 3:58 PM
Here is the solution !

store: myArrayStore,
beforequery:function() {

29 Dec 2015, 10:49 AM
I'm glad you were able to resolve this. Thanks for providing your solution.