2012-08-10 661 views
0

如何設置TabPanel選項卡寬度和選項卡高度?如何設置TabPanel標籤寬度和標籤高度?

我想:

var myTabPanel = Ext.create('Ext.TabPanel', { 
    fullscreen: true, 
    tabBarPosition: 'top', 
    resizeTabs: true, 
    tabWidth: 300, 
    //minTabWidth: 300 
     .... 

,但它不工作

+1

你在哪裏找到這些配置:resizeTabs,tabWidth,minTabWidth? – 2012-08-10 15:36:54

+0

http://www.sencha.com/forum/showthread.php?88910-Ext.TabPanel-increase-tab-size – 2012-08-13 08:10:14

+0

這是關於EXTJS 3的討論,不是Sencha Touch 2 – 2012-08-13 09:08:00

回答

0

這裏面煎茶css文件中的所有這種事情發生。你需要在那裏修改它。

0

好消息,

我發現以編程方式做到這一點的方式。

//assuming you are using the MVC structure as suggested 
/*In the controller class of your view with the tab panel you must have reference to the tab panel in refs config. 
The reference name for this case will be: myTabpanel 
*/ 

//somewhere in the controller class 
var tabPanelItems = this.getMyTabpanel().getItems; //get all the items inside the tab panel (if i'm not mistaken this will also return some "extra" item which is not panel 
for (var i = 0; i < panels.length; i++) { 
    //due to that extra item i mentioned, need to make sure current item is a tab by confirming "tab" property existence 
    if (panels.items[i].tab) { 
    panels.items[i].setWidth('100px'); 
    panels.items[i].setHeight('25px'); 
    } 
} 

就是這樣。 關鍵在於它的一個Tab-panel(帶有面板的標籤)因此只配置我們首先需要的標籤部分,否則我們只會默認配置面板部分。