PDA

View Full Version : About Ext.data.StreeStore. It can not autowired model in MVC.



andy_ghg
2 Nov 2012, 2:01 AM
Happy Halloween.


This is my 'model' code here:


Ext.define('SystemSetup.model.SYSMenu', {
extend : 'Ext.data.Model',
fields : [{
name : 'task',
type : 'string'
}, {
name : 'user',
type : 'string'
}, {
name : 'duration',
type : 'string'
}, {
name : 'done',
type : 'boolean'
}]
});


Then, I create a new 'Store' and use 'SystemSetup.model.SYSMenu':



Ext.define("SystemSetup.store.SYSMenus",{
extend : "Ext.data.TreeStore",
model : "SystemSetup.model.SYSMenu",
proxy : {
type : 'ajax',
//the store will get the content from the .json file
url : 'data/treegrid.json'
},
folderSort : true
});


But when I run this application, Ext JS can not autoload 'SystemSetup.model.SYSMenu' file.


So I changed 'Ext.data.TreeStore' parent class just like this:


Ext.define('Ext.data.TreeStore', {
extend: 'Ext.data.Store',
//..........

It's running fine. Who can tell me is that a bug? If that is not a bug, could you tell me how can I fix it?


Could it be that just like that?

Hope you all give me a reply. Thank you guys~!

vietits
2 Nov 2012, 2:51 AM
Try to fix your code as below:


Ext.define("SystemSetup.store.SYSMenus",{
extend : "Ext.data.TreeStore",
requires: ["SystemSetup.model.SYSMenu"],
model : "SystemSetup.model.SYSMenu",
proxy : {
type : 'ajax',
//the store will get the content from the .json file
url : 'data/treegrid.json'
},
folderSort : true
});