Ext.onReady(function(){	var MenuRecord = Ext.data.Record.create([                     {name: 'menu_active', type: 'int'},                     {name: 'menu_id', type: 'int'},                     {name: 'menu_title', type: 'string'},                     {name: 'menu_link', type: 'string'}                   ]);	var ds =  new Ext.data.Store({	          url: baseUrl + 'index/get-menu',	          autoLoad: true,	  		  reader: new Ext.data.JsonReader(	  				{	  					totalProperty: "results",	  				    root: "rows",	  				    idProperty: "id"	  				}, MenuRecord),	  		  listeners:	  	      {		        load: function(store, data, object) {                  for (var i=0;i<data.length;i++) {                    if (data[i].data.menu_active){						var activeTab = i + 1;                        Ext.get(Ext.query("#tabs li:nth-child("+activeTab+")")).replaceClass('', 'active');                    }                  }                }	  	      }			});	var tpl = new Ext.XTemplate(			'<ul>',		    '<tpl for=".">',		           '<li><a href="'+baseUrl+'{baseUrl}{menu_link}">&nbsp;{menu_title}&nbsp;</a></li>',		    '</tpl>',		    '</ul>'		);var dataview = new Ext.DataView({    store: ds,    tpl: tpl,    autoHeight:true,    renderTo: 'tabs',    itemSelector:'li',    emptyText: 'No menu to display'/*    ,listeners:    {		beforeclick: function(thisObj,index,node,eventObj) {//			$("#tabs li").removeAttr('class');//			$("#tabs li:eq("+index+")").attr('class','active');	    },	    afterrender : function(){		}    }*/});});
