我正在尝试为网格表中的 2 列添加背景颜色。我该怎么做?
我知道 ExtJS 4 - How to add background colors to columns of a grid? ,但我正在寻找我可以使用的特定属性而不是函数。我可以配置任何属性来在此处添加背景颜色吗?
请在下面找到我的代码-
var ALIASGRID = new Ext.grid.EditorGridPanel({
store : ALIASGRIDStore,
stripeRows : true,
hideHeaders : true,
id : "ALIASGRID",
region : 'center',
clicksToEdit : 1,
autoHeight : true,
viewConfig : {
markDirty : false
},
columnLines : true,
columns : [ {
id : 'Test',
header : 'Test',
dataIndex : 'Test',
width : 30,
editor: {
xtype: 'textfield',
triggers: {
search: {
cls: 'x-fa fa-search',
handler: function (field, trigger, eOpts) {}
}
}
},
renderer : renderTooltipAndId
}],
listeners : {
beforeedit : function(grid) {
if (!attributeMgrEnabled) {
return false;
}
// console.log(grid);
}
}
});
var ALIASFOOTER = new Ext.grid.EditorGridPanel({
enableHdMenu : false,
id : 'ALIASFOOTER',
height : 19,
store : ALIASFOOTERStore,
columns : [ {
id : 'Test',
header : 'Testing.',
resizable : false,
width : 30
}]});
// Table that shows empty rows & a footer
var layoutTable1 = new Ext.Panel({
width : 470,
items : [ ALIASGRID, ALIASFOOTER ],
renderTo : 'AliasTable'
});
我曾尝试使用
bodyStyle: 'background-color: #ff0000';
属性,但它没有用。
您可以在列上使用
tdCls
配置来定义相应列的各个单元格的类。
https://docs.sencha.com/extjs/7.6.0/classic/Ext.grid.column.Column.html#cfg-tdCls