NullCod3
NullCod3

Reputation: 321

lookup in Ext.StoreManager.lookup is not defined

This is my view:

Ext.define('MyApp.view.Login.LoginForm',{
    extend: 'Ext.form.Panel',
    alias: 'loginForm',
    requires: ['Ext.form.FieldSet', 'Ext.Img'],
    config: {
        items: [
            {
                xtype: 'fieldset',
                items: [
                    {
                        xtype: 'textfield',
                        name: 'username',
                        required: true
                    },{
                        xtype: 'textfield',
                        name: 'password',
                        required: true,
                        inputType: 'password'
                    },{
                        xtype: 'selectfield',
                       //*****************the problem is here****************
                        store: Ext.StoreManager.lookup('MyApp.store.Tables')
                        //store: Ext.StoreManager.lookup('Tables')
                    }
                ]
            },{
                xtype: 'button',
                text: 'Login',
            }
        ]
    }
});

It says that it cannot use lookup of undefined, so I'm thinking that MyApp doesn't see Ext.StoreManager.

I've also tried Ext.data.StoreManager.lookup and Ext.StoreMgr. BTW. the store really exist.

Upvotes: 4

Views: 5748

Answers (2)

Thiem Nguyen
Thiem Nguyen

Reputation: 6365

Try following these instructions and let me know if it works:

  1. Make sure to include the store in your app.js file
  2. In Tables.js store implementation file, give it an storeId inside its config, like this: config: {storeId: 'Tables'}
  3. Using this instead of Ext.StoreManager: store: 'Tables'

Hope it helps.

Upvotes: 2

Anand Gupta
Anand Gupta

Reputation: 5700

Your store config should be like this:

Ext.define('MyApp.store.Tables', {
    extend: "Ext.data.Store",
    config: {
        model: "MyApp.model.Table",
        data : [{
            text: "Ed",    
            value: "Spencer"
        }, {
            text: "Tommy", 
            value: "Maintz"
        }]
    }
});

And place this into your LoginForm.js:

{
      xtype: 'selectfield',
      store: 'Tables'
}

I have tested. It is working fine.

Upvotes: 2

Related Questions