Question

My req: I have a column called status and I want to set the colors to the columns values based and not the entire row.

So if status is 'approved' then set the approved value to color green..etc. I followed the link below to set the colors to the items in the list.

http://www.sharepoint-journey.com/alternate-color-for-a-column-in-SharePoint-list-using-jquery.html

but the selector '.ms-vb2' is check for all the column value in the list. So even if the other columns have a value called 'approved this deal'..It might also color this field. How to avoid it

Was it helpful?

Solution

I have a list that uses jQuery to change the value in columns like this

enter image description here

Here is the jQuery

<script type="text/javascript">
$(document).ready(function(){

$Text = $("td.ms-cellstyle.ms-vb2:contains('Gold')");
$Text.css("color", "#ff993a");
$Text.css("font-weight", "bold");

});
</script>

I have included jQuery in my master page and then I added a script editor webpart to the page where the list is

hope this helps

OTHER TIPS

Check this out: http://blog.pathtosharepoint.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/

Basically the idea is to create a calculated column that will output some HTML with some inline CSS (e.g. <div style="background-color:X"> or <span style="color:X">). The X color is calculated upon the Status column via nesting IF formula or similar approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top