2011-08-18 22 views
4

我有一個帶有幾個選項卡的Tab面板。我在選項卡中使用iconCls屬性爲每個選項卡提供一個圖像及其標題。我正在使用fam fam fam 16x16 icons,並且默認的標籤空間會在頂部/底部關閉圖像。更改高度或添加填充到EXTjs ext.tab.Tab組件

我試圖通過改變邊距來改變圖標的​​類,但它沒有幫助。根據文檔,ext.tab.Tab組件具有填充和高度屬性,但在運行時將其設置爲對選項卡沒有影響。

Ext.define('AM.view.Tab.Standard', { 
    extend: 'Ext.tab.Panel', 
    alias: 'widget.TabStandard', 

    region: 'center', // a center region is ALWAYS required for border layout 
    deferredRender: false, 
    activeTab: 0,  // first tab initially active 

    initComponent: function() { 
     this.items = this.buildItems(); 

     this.callParent(arguments);  
    }, 

    buildItems: function(){ 
     var items = 
      [ 
       { 
        padding: 10, // nope :(
        title: 'Gantt', 
        autoScroll: true, 
        iconCls: 'gantt icon', 
       }, 
       { 
        height: 10, // nope :(
        title: 'Logs', 
        autoScroll: true, 
        iconCls: 'logs icon', 
       }, 
       { 
        title: 'Help', 
        autoScroll: true, 
        iconCls: 'help icon', 
       } 
      ]; 
     return items 
    }, 
}); 

也許我誤解了這些屬性是如何工作的,但頁面上的所有內容看起來都是一樣的。

編輯:當用作手風琴面板時,出現「標題」(帶有+/-的欄)時出現同樣的問題。

+0

你爲什麼不嘗試用CSS? – Unknown

+0

我試過了,我可以單獨更改按鈕的屬性,但標籤面板的內容窗口不會被推下來以適應新的高度。我希望將這些屬性傳遞給按鈕也會影響內容窗口。也許不會? – Robodude

+0

Ok.But嘗試更改使用標籤在css中的標籤屬性,你可以得到特定的CSS在firebug.Hope你會得到結果。 – Unknown

回答

2

可以通過使用上的TabPanel的tabBar屬性定製的標籤面板選項卡:

var tabpanel = new Ext.tab.Panel({ 
    plain: true, 
    region: 'center', 
    tabBar: { 
     defaults: { 
      flex: 1, // if you want them to stretch all the way 
      height: 20, // set the height 
      padding: 6 // set the padding 
     }, 
     dock: 'top' 
    } 

});