SharePoint 2013 - Changing a row color when calculated columns is True or any column is True

Hello Experts,

I've sxoured the web and tried all the solutions that came close in theory but did not work.
I'm looking tonhave the row color of an item of the value is true Or a calculated column's value is true .

Would be very grateful for your help.

Thanks in advance.
colonelblueAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
which SharePoint edition? Foundation, Server or online?
Is this for a single page?
Would be jQuery / Javascript code be an option for you?

Decission columns:
Can you please add information about the data types of the two columns you mentioned?

Thanks.
Rainer
0
colonelblueAuthor Commented:
Hello Rainer ,

Sorry .
SP2013
Single page
Sure I'm open to any solution.
Data from a list.
In particular is row of data verified
If verified= True then color
Or if value of a select is Sun then or row
Colored Orange?
0
colonelblueAuthor Commented:
Hello Rainer , did I give enough information ?

Thank you!
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Rainer JeschorCommented:
Hi colonelblue,
for the first try this should be enough.
I have currently no local 2013 farm available for testing, but the following should work:
<script type="text/javascript" src="/TestingJR/SiteAssets/jquery-1.11.2.js"></script>
<script type="text/javascript" >
function ColorMyListAppWebPart() {
  jQuery("table.ms-listviewtable tbody td:nth-child(6)").each(function() {
    var cellContent = jQuery(this).text();
    if (cellContent == "Orange") {
      jQuery(this).closest("tr").css("background-color", "#FFFF66");
    }
  });
  jQuery("table.ms-listviewtable tbody td:nth-child(5)").each(function() {
    var cellContent = jQuery(this).text();
    if (cellContent == "Ja") {
      jQuery(this).closest("tr").css("background-color", "Green");
    }
  });
}
_spBodyOnLoadFunctionNames.push('ColorMyListAppWebPart');
</script>

Open in new window

Explanation:
1. Step: If you have not yet loaded a jQuery library file (e.g. through the master page) then please download a current version (depending on your supported browsers versions 1.11.2 or 2.x.y) and upload it to the site assets library. Please adjust the path to the js file (line one of the above code).
Step 2:
Currently the script looks for the content (text) of the nth-column and depending on the condition it sets the parents TR background color. The column "index" is based on 1 (not like all other indexes in JavaScript which are zero-based) and you have to count also the "helper" columns for the context menus and the row checkboxes. Therefore the 5th visible column might have nth-child(7) (but that depends on your configuration).
For each condition an additional block has to be added - the above sample looks for a dropdown value named "Orange" as well as a Boolean calculated field which has either "Ja" (Yes) or "Nein" (No) (sorry - german settings).

I have to wait for my demo SharePoint online site to have scripting web parts enabled to test it for myself.

General scenario:
Wiki page where an App WebPart for a custom list is added.
HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rainer JeschorCommented:
Sorry. forgot step 3:
Edit the page and use the "Embed script" action in the ribbon to add the complete script.

And add-on to step 2: please adjust also the background colors for your needs.
0
colonelblueAuthor Commented:
You''re awesome Rainer!!

Thank you so much for your brilliance!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.