So I was tasked with causing the cells of a calculated column in a list to change color per its value. Similar to conditional formatting in Excel and InfoPath. Used this little bit of jQuery… I would love to hear if this is a good solution, or if a more elegant solution can be used:
//note: I did not use variables for brevity.
$(‘table.ms-listviewtable td:nth-child(11) div’).each(function () {
if($(this).html() > “1” ){
$(this).css(‘background-color’, ‘red’);
$(this).css(‘color’, ‘white’);
}
else if($(this).html() == “1”){
$(this).css(‘background-color’, ‘yellow’);
$(this).css(‘color’, ‘black’);
}
else if($(this).html() < “1”){
$(this).css(‘background-color’, ‘green’);
$(this).css(‘color’, ‘white’);
}
});
I have used Christophe’s color solutions for years on our MOSS 2007 site and they work wonderfully! Â Also use his Easy Tabs solution. Â Highly recommend them!
If you have an end users who are not comfortable with coding, Path to SharePoint has a nice solution: Â http://usermanagedsolutions.com/SharePoint-User-Toolkit/Pages/Color-Coding-Calendar-List.aspxÂ