2012-10-26 27 views
1

我有下一段代碼如何在ExtJs actionColumn項目中設置樣式?

{ 
xtype: 'actionColumn', 
id: 'act_id', 
width: 30, 
flex: 0, 
items: [{ 
    getClass: function(v, meta, record) { 
     if(record.get('blahblah') == true) 
     return 'aClassName'; 
     else 
     return 'aOtherClassName'; 
    } 
    }] 
} 

確定這一段代碼工作正常,但我喜歡我的圖標添加在一條線上的風格,但是當我使用類似:

{ 
xtype: 'actionColumn', 
id: 'act_id', 
width: 30, 
flex: 0, 
items: [{ 
    getClass: function(v, meta, record) { 
     if(record.get('blahblah') == true) 
     return 'aClassName'; 
     else 
     return 'aOtherClassName'; 
    }, 
    style: {'width':'16px'} 
    }] 
} 

什麼都沒發生。我嘗試了1000種不同的方式,但沒有任何方法,而在ExtJs 4中我找不到任何有關這方面的信息。

+0

我知道快速方式是創建一個類,但我需要在這種情況下樣式內聯。 – aperez

回答

0
{ 
xtype: 'actionColumn', 
id: 'act_id', 
width: 30, 
flex: 0, 
items: [{ 
    getClass: function(v, meta, record) { 
     meta.attr = "style='width:16px;'"; 
     if(record.get('blahblah') == true) 
     return 'aClassName'; 
     else 
     return 'aOtherClassName'; 
    } 
    }] 
} 
相關問題