Results 1 to 2 of 2

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

  1. #1

    Default How to update a Ext.form.ComboBox store (simple store) once created in a Ext.window

    Hi,

    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 :

    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 })
                        
                        console.log(rec.data.value)
    
                        var liste = [rec.data.text, rec.data.value];
                        layer_liste_WCS.push(liste)
                    }
                }) ;
                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];
                    layer_liste_WCS.push(liste)
                    disabled: true
    
                }
            };
            addComboxFieldItemsWCS();
    
            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,
                width: FIELD_WIDTH,
                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,
                    height:20,
                    items: [{ // we will declare 3 tabs
                        title: OpenLayers.i18n('Datas Inputs'),
                        closable:false,
                        iconCls: 'input_icon',
                        active: true,
                        items:[{
                            xtype: 'form',
                            autoWidth: true,
                            labelWidth: 185,
                            bodyStyle: "padding:10px;",
                            items: [
                                ImageField,
                            ]                        
                        }]
                    }]    
                }],                      
            });
        },

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579

    Default

    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?
    Tristan Lee
    Sencha Inc - Sustaining Engineer


    Having an issue? Help us help you - be detailed; provide some code; demonstrate with a fiddle (fiddle.sencha.com)

    Embed your fiddle in your post: [FIDDLE]id[/FIDDLE]

Similar Threads

  1. Replies: 1
    Last Post: 25 Sep 2014, 3:04 PM
  2. [INFOREQ] ComboBox dynamically created store
    By emce in forum Ext:Bugs
    Replies: 3
    Last Post: 3 Jun 2014, 5:13 AM
  3. Combobox not loading from created store (MVC)
    By fullbl in forum Ext: Q&A
    Replies: 5
    Last Post: 10 Aug 2013, 5:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •