How to focus on the first tab with multiple tabs

 var tabs = Ext.widget('tabpanel', {
        renderTo: 'tabs',
        resizeTabs: true,
        enableTabScroll: true,
        width: 600,
        height: 250,
        defaults: {
            autoScroll: true,
            bodyPadding: 10
        },
        items: [{
            title: 'Tab 1003',
            iconCls: 'tabs',
            //ref:'http://www.yahoo.com',
            //hrefTarget:'_self',
            html: '<div style="width:100%; height:100%; background-color:#cccccc;"><iframe src="http://www.w3schools.com" frameborder=0  style="width:100%; height:100%;"></iframe></div>',
            closable: true,
            focusOnToFront  : true
        }],.........................

      

how to focus on the first tab when having multiple tabs? I am using focusOnToFront but it doesn't work.

+3


source to share


2 answers


Seeing that you already have a tab defined in a variable tabs

, if you want to make your first tab visible, the easiest way is:

tabs.setActiveTab(0);

      



As described here in the docs.

+1


source


Add the property activeTab

:



var tabs = Ext.widget('tabpanel', {  
    activeTab: 0,
    ...

      

0


source







All Articles