当有几个标签时,如何专注于第一个标签

时间:2013-01-31 16:48:34

标签: extjs extjs4

 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,但它看起来不起作用。

2 个答案:

答案 0 :(得分:1)

看到您已在变量tabs中定义了tabpanel,如果您想让第一个标签可见,最简单的方法就是:

tabs.setActiveTab(0);

正如文档中的here所述。

答案 1 :(得分:0)

添加activeTab属性:

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