如何设置TabPanel选项卡宽度和标签高度?

时间:2012-08-10 09:10:02

标签: sencha-touch-2

如何设置TabPanel标签宽度和标签高度?

我试过了:

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

但它不起作用

2 个答案:

答案 0 :(得分:0)

这就是sencha css文件中发生的一切。你需要在那里修改它。

答案 1 :(得分: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');
  }
}

就是这样。 关键是它的一个标签面板(带面板的标签)因此只配置我们首先需要获得标签部分的标签部分,否则我们将默认配置面板部分。