extjs - 未定义 Ext.StoreManager.lookup 中的查找

标签 extjs sencha-touch-2

这是我的观点:

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',
            }
        ]
    }
});

说不能用lookup of undefined ,所以我认为 MyApp 没有看到 Ext.StoreManager。

我也试过 Ext.data.StoreManager.lookupExt.StoreMgr .
顺便提一句。这家店真的存在。

最佳答案

你的商店配置应该是这样的:

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

并将其放入您的 LoginForm.js 中:
{
      xtype: 'selectfield',
      store: 'Tables'
}

我已经测试过了。它工作正常。

关于extjs - 未定义 Ext.StoreManager.lookup 中的查找,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20104602/

相关文章:

javascript - 如何在 Ext js 4.0 中调整网格大小时调用函数?

javascript - Sencha Touch 中文本字段上的点击事件

javascript - Sencha 触摸 2 : Passing data from controller to a view

sencha-touch - Sencha touch 表单面板未显示

RIA 的 ExtJS 与 Sencha Touch

javascript - Extjs:使用提交表单上传文件

java - 在 Extjs 中,在 Grid 中更新时,如果 session 超时如何重定向到登录页面?

javascript - Ext js 4.2.1 警告框看起来不太好

javascript - 定义面板并在视口(viewport)中实例化它

list - Sencha 2.0 动态更改标题工具栏