javascript - sencha extjs4.1 ext.tab.panel activetab -


how can use setactivetab grid within tab.panel? need onload button/grid stay in tab panel actives from. when click on button second tab want second tab set. instead returns first tab. below bare bones code, stripped out attempt use setactivetab:

<script type="text/javascript"> //begin menu bar ext.define('mainnavbar.view.ui.mainnavpanel', {     extend: 'ext.tab.panel',     height: 170,     width: 1000,     activetab: 0,     initcomponent: function() {             var me = this;         me.items = [             {                 xtype: 'panel',                 height: 145,                 width: 684,                 title: 'bus data',                 dockeditems: [                     {                         xtype: 'toolbar',                         height: 145,                         width: 938,                         dock: 'top',                         items: [                              {                                 xtype: 'buttongroup',                                 height: 140,                                 title: 'bid',                                 columns: 2,                                 layout: {                                     columns: 2,                                     type: 'table'                                 },                                 items: [                                     {                                         xtype: 'button',                                         text: 'bid doc',                                         handler: function(){window.location = '/biddoc/';}                                                                             },                                 ]                             },                         ]                     }                 ]             },             {                 xtype: 'panel',                 height: 115,                 title: 'reporting',                 dockeditems: [                     {                         xtype: 'toolbar',                         height: 140,                         dock: 'top',                         items: [                             {                                 xtype: 'buttongroup',                                 height: 140,                                 title: 'sales data',                                 columns: 2,                                 layout: {                                     columns: 2,                                     type: 'table'                                 },                                 items: [                                     {                                         xtype: 'button',                                         text: 'batch',                                         handler: function(){window.location = '/salesdatabatch/';}                                       }                                 ]                             }                         ]                     }                 ]             },          ];         me.callparent(arguments);     } });        ext.define('mainnavbar.view.mainnavpanel', {     extend: 'mainnavbar.view.ui.mainnavpanel',      initcomponent: function() {         var me = this;         me.callparent(arguments);     } }); ext.loader.setconfig({     enabled: true }); ext.application({     name: 'mainnavbar',     launch: function() {         ext.quicktips.init();          var cmp1 = ext.create('mainnavbar.view.mainnavpanel', {             renderto: menu         });         cmp1.show();     } }); //end menu bar          </script> 

lets compile discussed here , make correct answer.

@lorenz meyer has point there. have architecture problem , can solve example ext.ajax.request({/** code here **/});. there no redirecting.
if need example how this, please refer this: extjs - servlets

but did not ask architecture problem answer.

so after little thinking made corrects code. please take , if mark answered:

ext.define('mainnavbar.view.ui.mainnavpanel', {     extend: 'ext.tab.panel',     height: 170,     width: 1000,     activetab: 0,     initcomponent: function() {             var me = this;         me.items = [             {                 xtype: 'panel',                 height: 145,                 width: 684,                 title: 'bus data',                 dockeditems: [                     {                         xtype: 'toolbar',                         height: 145,                         width: 938,                         dock: 'top',                         items: [                              {                                 xtype: 'buttongroup',                                 height: 140,                                 title: 'bid',                                 columns: 2,                                 layout: {                                     columns: 2,                                     type: 'table'                                 },                                 items: [                                     {                                         xtype: 'button',                                         text: 'bid doc',                                         handler: function(){window.location = '/biddoc/';}                                                                             },                                 ]                             },                         ]                     }                 ]             },             {                 xtype: 'panel',                 height: 115,                 title: 'reporting',                 dockeditems: [                     {                         xtype: 'toolbar',                         height: 140,                         dock: 'top',                         items: [                             {                                 xtype: 'buttongroup',                                 height: 140,                                 title: 'sales data',                                 columns: 2,                                 layout: {                                     columns: 2,                                     type: 'table'                                 },                                 items: [                                     {                                         xtype: 'button',                                         text: 'batch',                                         handler: function(){window.location = '/salesdatabatch/';}                                       }                                 ]                             }                         ]                     }                 ]             }         ],         listeners: {             afterrender: function(component, eopts) {                 var urlinfo = document.location.href;                 if(urlinfo.contains('salesdatabatch')){                     component.setactivetab(1);                 }                 if(urlinfo.contains('biddoc')){                     component.setactivetab(0);                 }             }         },         me.callparent(arguments);     } });  

Comments