[英]In ExtJS, how do you change the background color of an actioncolumn?
我有一個使用Ext.grid.ColumnModel的ExtJS Web應用程序。 對於其中一列,我需要設置基於
var result = new Ext.grid.ColumnModel(
[
{
xtype: 'actioncolumn',
header: 'Delete',
align: 'center',
width: 50,
border: false,
items: [{
getClass: function (v, meta, record) {
if ((record.get('materialType') == '95'){
this.items[0].tooltip = "Delete all three";
this.items[0].tdCls = 'background-color: #F1F1F1;';
}
else {
this.items[0].tooltip = "Delete just one";
this.items[0].tdCls = 'background-color: #FFFFFF;';
}
}
}
設置工具提示效果很好; 設置背景顏色沒有運氣。 有什么建議么?
預先感謝,蒂姆
我相信您需要在該getClass函數中使用meta參數
meta.attr = 'background-color: #F1F1F1;'
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.grid.column.Action
tdCls
屬性被設計為css類的名稱,而不是某些css指令。 例如 :
this.items[0].tdCls = 'myclass'
並在您的CSS中:
.myClass { background-color: #FFFFFF;}
如果您不想使用類,則可以使用style
屬性。
有關更多信息,請參見http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.column.Column-cfg-renderer 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.