这是我的观点:
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.lookup
和 Ext.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/