0

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

2
  • 1
    Why don't you open the list in SharePoint designer and use conditional formatting to set 'approved status' to green Jan 8, 2016 at 21:26
  • I was just looking through this thread and was wondering the same thing. Unless I'm missing something, there's no reason to jump directly into jquery, especially with MOSS. Conditional formatting should suit your needs perfectly. Jan 8, 2016 at 23:33

2 Answers 2

0

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

0

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.