当有几个选项卡时,如何专注于第一个选项卡


 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
        }],.........................

当有几个选项卡时,如何专注于第一个选项卡?我使用focusOnToFront,但它被看到不起作用。

看到您已经在变量tabs中定义了选项卡面板,如果您想使第一个选项卡可见,最简单的方法是:

tabs.setActiveTab(0);

如文档中所述。

添加 activeTab 属性:

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

最新更新