Results 1 to 5 of 5

Thread: Can you configure a combo with inline data?

  1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    419
    Vote Rating
    2
      0  

    Default Can you configure a combo with inline data?

    Hi,

    Is it possible to configure a combo box in Ext Designer using in-line array data for the store property?

    I just need a combo with 'True' and 'False' as options, and see you can use an inline array according to the ExtJS docs (v3.4). I had a go at setting this up in designer, generated code is below.

    Code:
    MyCombo19Ui = Ext.extend(Ext.form.ComboBox, {
        width: 100,
        cellCls: 'configFieldCell',
        store: '[\'True\',\'False\']',
        mode: 'local',
        triggerAction: 'all',
        allowBlank: false,
        initComponent: function() {
            MyCombo19Ui.superclass.initComponent.call(this);
        }
    });
    When I try and run the code that uses this combo box I get an error from the Extjs source code as follows:

    Code:
    this.store is undefined
    http://localhost:8080/ext-3.3.1/ext-all-debug.js
    Line 41111
    Thanks.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Store config should be a Store instance or an Array... what is there is a String so I assume ComboBox isn't recognizing it and creating a Store instance on the fly.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User gskluzacek's Avatar
    Join Date
    Feb 2010
    Location
    Algonquin, IL
    Posts
    63
    Vote Rating
    3
      0  

    Default

    It appears that when you specify the inline data (as an array) in the combo box's store config setting, Designer looks like its converting it to a string, I'm guessing this is a bug? But if you go in and directly edit the generated code (which you're not supposed to do) from:

    Code:
    Ext.define('MyApp.view.ui.ComboTest', {
        extend: 'Ext.panel.Panel',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'combobox',
                        fieldLabel: 'Label',
                        store: '[\'one\',\'two\',\'three\',\'four\']'
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    });
    to the following:

    Code:
    Ext.define('MyApp.view.ui.ComboTest', {
        extend: 'Ext.panel.Panel',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'combobox',
                        fieldLabel: 'Label',
                        store: ['one','two','three','four']
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    });
    -- Once you go Mac, you never go back!

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    13
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by gskluzacek View Post
    It appears that when you specify the inline data (as an array) in the combo box's store config setting, Designer looks like its converting it to a string, I'm guessing this is a bug? But if you go in and directly edit the generated code (which you're not supposed to do) from:

    Code:
    Ext.define('MyApp.view.ui.ComboTest', {
        extend: 'Ext.panel.Panel',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'combobox',
                        fieldLabel: 'Label',
                        store: '[\'one\',\'two\',\'three\',\'four\']'
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    });
    to the following:

    Code:
    Ext.define('MyApp.view.ui.ComboTest', {
        extend: 'Ext.panel.Panel',
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'combobox',
                        fieldLabel: 'Label',
                        store: ['one','two','three','four']
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    });
    I tried this but its showing error "Uncaught TypeError: Cannot call method 'indexOf' of undefined"

  5. #5
    Sencha User hobophobik's Avatar
    Join Date
    Jul 2010
    Location
    UK
    Posts
    22
    Vote Rating
    0
      0  

    Default

    I've also just come across this issue - the array being treated as a string.

    Is there a workaround?

    Update

    Must have been a syntax error as I can't replicate the issue now.

Posting Permissions

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