1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    395
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default Can you configure a combo with inline data?

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User gskluzacek's Avatar
    Join Date
    Feb 2010
    Location
    Algonquin, IL
    Posts
    63
    Vote Rating
    3
    gskluzacek is on a distinguished road

      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
    niveditaWebbee is on a distinguished road

      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
    hobophobik is on a distinguished road

      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.