PDA

View Full Version : How to change the background color of a column in grid?



netemp
15 Sep 2011, 6:52 AM
I need to apply different background colors to various columns of a grid panel, so that the complete column has the same background color. I tried with cls and tdCls config property but couldn't achieve it.


Could anyone please throw some light on how this can be done?


Thanks in advance.

ronniem
26 Sep 2011, 2:54 AM
use the renderer:

{
xtype: 'gridcolumn',
renderer: function(value,meta) {
meta.tdCls = "yellow";
return value;
}

css looks like this

.yellow div {
background-color: #fffde1;
border: 1px solid #fef89b;
}

mankz
26 Sep 2011, 4:33 AM
use the renderer:

{
xtype: 'gridcolumn',
renderer: function(value,meta) {
meta.tdCls = "yellow";
return value;
}

css looks like this

.yellow div {
background-color: #fffde1;
border: 1px solid #fef89b;
}

Overkill, just set 'tdCls' on your column config. How are you defining your columns?

w_goldman
15 Mar 2017, 12:34 PM
Overkill, just set 'tdCls' on your column config. How are you defining your columns?

When I do this only the column header changes color, cells do not.