View Full Version : How to update a Ext.form.ComboBox store (simple store) once created in a Ext.window

3 May 2015, 6:46 AM

I tried the find a solution of my case on many forms, but no success :(

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 !

Here is a part of the code :

createWindow: function() {

var FIELD_WIDTH = 250,
base = {
forceSelection: true,
editable: true,
allowBlank: true,
triggerAction: 'all',
mode: 'local',
labelSeparator: OpenLayers.i18n("labelSeparator"),
valueField: 'value',
displayField: 'text',
labelWidth: 300

var addComboxFieldItemsWCS = function() {
layer_liste_WCS = [];
var empty = true ;
layerStore.each (function (record) {
var layer = record.get('layer');
var queryable = record.get('queryable');
// var type = record.get('type');
var hasEquivalentWCS = record.hasEquivalentWCS()
if (queryable && hasEquivalentWCS) {
empty = false;

var ObjectRecordType = Ext.data.Record.create(['text', 'value']);
var rec = new ObjectRecordType({ text: layer.name, value:record })


var liste = [rec.data.text, rec.data.value];
}) ;
if (empty) {
var ObjectRecordType = Ext.data.Record.create(['text', 'value']);
var rec = new ObjectRecordType({ text: "No based WCS layer !", value:"" })

var liste = [rec.data.text, rec.data.value];
disabled: true


var WCS_store = new Ext.data.SimpleStore({
autoLoad: true,
fields: ['text','value'],
data: layer_liste_WCS

ImageField = new Ext.form.ComboBox(Ext.apply({
name: "Image_ref",
fieldLabel: OpenLayers.i18n("Spot Image Input (Required)"),
// fieldLabel: WPS_config.img.title, // From WPS Server
emptyText: OpenLayers.i18n("Select your Image"),
autoDestroy: true,
triggerAction: 'all',
queryMode: 'local',
store: WCS_store,
}, base));

return new Ext.Window({
title: OpenLayers.i18n("addon_wpsjussie_title"),
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: OpenLayers.i18n('Datas Inputs'),
iconCls: 'input_icon',
active: true,
xtype: 'form',
autoWidth: true,
labelWidth: 185,
bodyStyle: "padding:10px;",
items: [

5 May 2015, 5:57 AM
There looks to be a few dependencies your code is relying on that do not exist in your code sample. Could you create a small workable example as a fiddle (https://fiddle.sencha.com) so I can walk through your issue with you?