1
無論何時使用Model定義存儲,如下所示,我得到「無法讀取屬性」的未定義屬性getProxy'。Uncaught TypeError:無法讀取未定義的屬性'getProxy'
商店:
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
data: [
{ name: 'tommy', email: '[email protected] ' },
{ name: 'gani', email: '[email protected]' }
]
}, function() {
console.log('Store has loaded');
});
型號:
Ext.define('AM.model.User', {
extends: 'Ext.data.Model',
fields: ['name','email']
}, function() {
console.log('Model has loaded');
});
控制器:
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views: ['AM.view.user.List', 'AM.view.user.Edit'],
stores: ['AM.store.Users'],
models: ['AM.model.User'],
init: function() {
console.log('Controller class init called');
this.control({
'userlist' : { itemdblclick: this.editUser }
});
},
editUser: function(grid, record) {
console.log('User edit has started ...');
var view = Ext.widget('edituser');
view.down('form').loadRecord(record);
}
}, function() {
console.log('Controller has loaded');
});
然而,當內聯模型店鋪定義爲如下所示的東西工作的罰款。
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
fields: ['name', 'email'],
data: [
{ name: 'tommy', email: '[email protected] ' },
{ name: 'gani', email: '[email protected]' }
]
}, function() {
console.log('Store has loaded');
});
不確定爲什麼錯誤getProxy未定義,當模型被定義並附加到商店。
任何幫助將不勝感激。
感謝
問題更換得到解決,這是一種錯誤,擴展:「分機。 data.Model',而不是擴展名:'Ext.data.Model' – Chamarthi