I have a list view which I have been able to add colors to indicate progress in a status colum - Green (On Time) Yellow (Danger)and Red (Miss). I've been able to accomplish this for the standard view by using a Content Editor web part and using the following code:
<script type="text/javascript" language="javascript">
var x = document.getElementsByTagName("TD") // find all of the TDs
var i=0;
for (i=0;i<x.length;i++)
if (x[i].className=="ms-vb2") //find the TDs styled for lists
{
if (x[i].innerHTML=="Green-OnTime") //find the data to use to determine the color
{
x[i].style.backgroundColor='green'; // set the background color
x[i].style.color='white'; //set the font color
}
if (x[i].innerHTML=="Yellow-Danger") //find the data to use to determine the color
{
x[i].style.backgroundColor='Gold'; // set the background color
x[i].style.color='black'; //set the font color
}
if (x[i].innerHTML=="Red-Miss") //find the data to use to determine the color
{
x[i].style.backgroundColor='red'; // set the background color
x[i].style.color='white'; //set the font color
}
}
</script>
The problem is I cannot get this to work if the view is a Data Sheet View in the same list. Any suggestions for getting this to work in a data sheet view?