1. #1
    Sencha User andy_ghg's Avatar
    Join Date
    Feb 2009
    Location
    MeiLing Yangzhou JiangSu China
    Posts
    30
    Vote Rating
    0
    andy_ghg is on a distinguished road

      0  

    Default Unanswered: About Ext.data.StreeStore. It can not autowired model in MVC.

    Unanswered: About Ext.data.StreeStore. It can not autowired model in MVC.


    Happy Halloween.


    This is my 'model' code here:
    Code:
    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':

    Code:
    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:
    Code:
    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~!
    I like ExtJs
    ExtJs is My life~!

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    115
    Answers
    346
    vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold

      0  

    Default


    Try to fix your code as below:
    Code:
    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
    });

Thread Participants: 1

Tags for this Thread