开发者

ext js tab panel: which tab will be loaded by default?

开发者 https://www.devze.com 2023-02-08 09:51 出处:网络
In extjs, in a tabpanel, if there are multiple tabs, which one of them will be loaded by default when the panel is initialised? The first one? Is there a way t开发者_Python百科o set this?

In extjs, in a tabpanel, if there are multiple tabs, which one of them will be loaded by default when the panel is initialised? The first one? Is there a way t开发者_Python百科o set this?


var tabs = new Ext.TabPanel({
    renderTo: Ext.getBody(),
    activeTab: 0,     ///  ------- here is something what you looking for
    items: [{
        title: 'Tab 1',
        html: 'A simple tab'
    },{
        title: 'Tab 2',
        html: 'Another one'
    }]
});

I strongly belive what in this case first one...


When initializing an Ext.TabPanel the parameter activeTab is set to undefined. As far as I can tell, ExtJS interprets this as do not open any of the tabs when showing the tabpanel the first time. Even though no tabs are opened by default, the row of tabs will still be visible and fully functional.

You can set the parameter activeTab equal to the index of the tab you would like to see opened when the tabpanel is shown.

In the fine example given by bensiu, activeTab is set to 0, which will cause Tab 1 to be visible when the tabpanel is shown.

0

精彩评论

暂无评论...
验证码 换一张
取 消