I am using JSlink to change the cell color of a calculated column. I have to use Postrendering
for that. The problem is that I cannot manipulate the cells.
I can color the rows but cannot color just one cell. As long as I am not using the view, don't know how to change the background color of just one cell. I have tried to use dRate.columnname
, but it does not work.
Here is my function for changing the whole row color:
function ColourDv(ctx) {
for(var i=0; i < ctx.ListData.Row.length; i++)
{
var listItem = ctx.ListData.Row[i];
var iid = GenerateIIDForListItem(ctx, listItem);
var row = document.getElementById(iid);
var dRate = listItem.Delivery_x0020_Rate;
var nRate=dRate.replace('%','').replace(',','');
if (nRate < 900)
row.style.backgroundColor = "#d67763";
else if( nRate < 950 )
row.style.backgroundColor = "#f6ab3f";
else
row.style.backgroundColor = "#8cba3f";
}
}