Results 1 to 2 of 2

Thread: Cannot read property 'indexOf' of undefined

  1. #1
    Sencha Premium Member
    Join Date
    Sep 2013
    Posts
    99

    Default Cannot read property 'indexOf' of undefined

    I don't understand why I'm getting this error, all I'm trying to do is associate a generic store with a combobox to display the values from the store and I keep getting this error for some reason.

    comboBox:

    Code:
    {
                                xtype: 'combobox',
                                anchor: '100%',
                                itemId: 'testComboBox',
                                maxWidth: 300,
                                width: 1130,
                                fieldLabel: 'Type',
                                labelWidth: 50,
                                displayField: 'label',
                                store: 'TestStore',
                                valueField: 'label'
                            }
    store:

    Code:
    Ext.define('MyApp.store.TestStore', {
        extend: 'Ext.data.Store',
    
    
        requires: [
            'MyApp.model.TestModel'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                model: 'MyApp.model.TestModel',
                storeId: 'TestStore',
                data: [
                    {
                        catid: '1',
                        label: 'issue 1',
                        type: 'incident'
                    },
                    {
                        catid: '2',
                        label: 'issue 2',
                        type: 'incident'
                    },
                    {
                        catid: '3',
                        label: 'issue 3',
                        type: 'incident'
                    },
                    {
                        catid: '4',
                        label: 'issue 4',
                        type: 'incident'
                    }
                ]
            }, cfg)]);
        }
    });
    model:

    Code:
    Ext.define('MyApp.model.TestModel', {
        extend: 'Ext.data.Model',
    
    
        requires: [
            'Ext.data.Field'
        ],
    
    
        idProperty: 'catid',
    
    
        fields: [
            {
                name: 'catid'
            },
            {
                name: 'label'
            },
            {
                name: 'type'
            }
        ]
    });
    the combo box displays the values when i click on the drop down button, but it gets stuck with a loading message and I get the error mentioned above, could someone tell me what the problem is here please? am I missing something?

  2. #2
    Sencha Premium Member
    Join Date
    Nov 2007
    Location
    Moore, Oklahoma
    Posts
    505
    Answers
    10

    Default

    maybe add an alias to your store. Is your store registered? in a requires block somewhere before this is used.

    Code:
    extend: 'Ext.data.Store',
    alias: 'store.TestStore',
    also try to add queryMode: 'local' in the combobox.

Posting Permissions

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