1

I am trying to apply conditional formatting to my SharePoint list based on a few conditions.

For example I have a column (Month Needed) that the user selects a date from a drop down list in the format 11/2015 and so on. I would like to highlight (with colors) any row that has a date that is 90 days or less from the current date?

Unfortunately my SharePoint site does not allow me to create web parts in Designer so I am unable to add conditions that way and the JavaScript examples I have found don't really do what I need it to.

Here is an example of what I found: http://techtrainingnotes.blogspot.com/2008/11/sharepoint-color-coding-sharepoint.html

so a statement like the following:

if(text in Month Needed Column is 90 days less than Current date)
{
        background color = 'red';
}

Any guidance on how to accomplish this would be extremely helpful.

3
  • Tag your sharepoint version. Do you have permission to edit page and add script/content editor webpart? Commented Mar 25, 2015 at 15:15
  • @AmalHashim, yes I do have access to add script and use the CEWP.
    – JavaDev24
    Commented Mar 25, 2015 at 15:19
  • This question has two applicable answers (including one of my own!) sharepoint.stackexchange.com/questions/119277/…
    – John-M
    Commented Mar 25, 2015 at 15:53

1 Answer 1

1

In SharePoint 2013 we can use JSLinks to enhance how list views are displayed.

  1. Create a js file and store it in any of the library (SiteAssets)
  2. Inside the js file you can handle ItemOverride to add your specific condition and color change logic.

Detailed explanation can be found http://www.learningsharepoint.com/2013/04/04/color-code-list-items-with-javascript-using-js-link-in-sharepoint-2013/

http://yalla.itgroove.net/2014/09/25/conditional-color-coding-sharepoint-2013-task-list-using-jslink/

Your Answer

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

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