PDA

View Full Version : Is it possible to change background colour of a single grid cell



silcreval
9 May 2012, 1:43 PM
I need to change the colour of a grid cell based on the value passed into the render function.

eg.

render: function(val){
return ...
}

I'm just not 100% on what I should return. I've tried

<div style="background-color:"+val+"></div>

but that doesnt seem to do anything. val is a string which is one of
several values like '#000080' etc.

slemmon
9 May 2012, 2:03 PM
try:


renderer: function (value, metaData, record, row, col, store, gridView) {
metaData.style = 'color:#D10000;font-weight:bold;background:#F7E4E4;' // background color of pink, font color of red, and font-weight of bold
return value;
}