Search This Blog

Monday, March 16, 2015

SharePoint Lists Conditional Formatting using SharePoint Designer 2010

We will try to format the list item background color based on the task status field value.
image
Let’s start by launching SharePoint Designer 2010 and open our target site. I created the list on this blog so the address will be: http://sharepointstack.local. Navigate to the Lists and Libraries and click on the Tasks list.
image
Right click the All Tasks view and select Edit File in Advanced Mode. Bear in mind that we are editing only the All Tasks view, formatting set here will not be reflected on the other views.
image
Click inside any field in any list item and choose Format Row under Conditional Formatting on the ribbon.
image 
Inside the Condition Criteria dialog, set the Field Name to Status; Comparison to Equals, and Value to Not Started. The cool thing about Choice fields is you don’t have to write the value, the dropdown will contain all the field values. So our criteria will apply only to tasks where the Status field value equals Not Started. Click on Set Style.
image
In the Modify Style dialog, click on Background and modify the background-color value. Remember, this is CSS we are setting on XSLT, so we can add and format background images as well.
image
You will need to repeat this for the rest Task statuses: In Progress, Completed, Deferred, and Waiting on someone else. While you are setting up conditional formatting you will notice the Conditional Formatting pane on the right with all created styles. I know what is going in your mind, No you can’t copy the styles from the pane and paste them in another view Winking smile
image
You can modify your existing styles simply by clicking on Modify Style from the style cascading menu.
image
Save your view and navigate back to your Tasks list. Taraaaaa..! Open-mouthed smile The list is formatted.
image
Let’s try adding a new Task and set the status to Completed.
image
As you can see, the new Task was formatted based on our conditional formatting setup.
image

No comments:

Post a Comment