Ext.StoreManager.lookup中的查找未定义(lookup in Ext.StoreManager.lookup is not defined)
这是我的看法:
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 。 BTW。 商店真的存在。
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.
最满意答案
您的商店配置应该是这样的:
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' }我测试过了。 它工作正常。
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.
更多推荐
发布评论