Ext.ns('app');

app.menus = Ext.extend(Ext.tree.TreePanel,{
	region: 'west',
	
	width : 200,
    animate: true,
    containerScroll: true,
    dataUrl: '/tree/group',
    rootVisible  : false,
    sType : 'group',
    root: {
        nodeType: 'async',
        id: '0'
    },
    initComponent : function(){
    	this.tbar = [{
    		text : 'Төрөл',
    		handler: this.reLoadHandle.createDelegate(this,['group'])
    	},{
    		text : 'Урсгал',
    		handler: this.reLoadHandle.createDelegate(this,['ganre'])
    	},{
    		text : 'Шилдэгүүд',
    		icon : www.url+'/css/w/trophy.png',
    		handler: this.reLoadHandle.createDelegate(this,['bestof'])
    	}];
    	this.getSelectionModel().on('selectionchange', function(t, node){
    		if(node){
    			this.fireEvent('menu_change2select',node.id,this.sType);
    		}
    	},this);
		app.menus.superclass.initComponent.call(this);
	},
	reLoadHandle : function (type){
		this.sType = type;
		this.getLoader().dataUrl= '/tree/'+type;
		this.getLoader().load(this.getRootNode());
		this.fireEvent('menu_change2select',0,this.sType);
	}
});
