Error while defining a store
I'm trying to create a simple list with a store in a tab panel and this is the code I did.
Code:
Ext.define('myApp.model.Test', {
extend: 'Ext.data.Model',
fields: ['id', 'title', 'cls']
});
Ext.define('myApp.store.Test', {
extend: 'Ext.data.Store',
config: {
model: 'myApp.model.Test',
sorters: 'title',
getGroupString: function(record) {
return record.get('title')[0];
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'menu'
}
},
data : {
menu: [{
id: 1,
title: 'Element 1',
cls: 'clsOne'
},{
id: 2,
title: 'Element 2',
cls: 'clsTwo'
}]
}
}
});
Ext.define('myApp.view.Main', {
extend: 'Ext.TabPanel',
config: {
fullscreen: true,
tabBarPosition: 'bottom',
items: [
{
xtype: 'list',
title: 'Home',
grouped: true,
indexBar: true,
iconCls: 'star',
itemTpl: '{title}',
store: Ext.create("myApp.store.Test")
}
]
}
});
Ext.application({
name: 'myApp',
launch: function() {
var mainPanel = Ext.create('myApp.view.Main').setActiveItem(0);
}
});
The problem is that I get this error: c.model.getProxy si undefined
I tried to set the proxy in 'myApp.model.Test' class I created too but nothing worked.
If I create an inline instance of Ext.data.Store with the same code of 'myApp.store.Test' class it works but when I define a class extending a store and I try to create an instance of it, this error always appears.
What did I do wrong?