2012-08-10 659 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(带有面板的标签)因此只配置我们首先需要的标签部分,否则我们只会默认配置面板部分。