Privacy & Cookies
This site uses cookies. By continuing, you agree to their use. Learn more, including how to control cookies.
Login to your SharePoint online site and make a new Custom List. Click the gear on top right corner, click Add an app and then click Custom List , as below:
Give list a name Status List, and click Create.
Your new Custom List is created, and its name is Status List . Click Status List.
After clicking you will be on the list page as below:
Look on the top ribbon, under List option click Settings and then again click List Settings as below:
You will see the Settings page, click Create Column as below. Click it:
After clicking you will see settings for creating the column as below. Input the fields, Column name as Status , type of information will be selected as Choice and type the options or choices you want in the list. Please see as below and then press Ok.
Now, your new column is created.
Click the list,
Now, open another browser and type the link //www.jquery.com/download/ . On this page you will see jquery libraries, that you need to download and save in SharePoint Library. You can store this library in Site Assets. We will need this for writing jquery code to do the task. Now follow the snapshots:
Save it on desktop temporarily, and then from your SharePoint Site Contents go to Site Assets and upload jquery-1.11.2.min in Site Assets as below:
Now go back to your list and go to Edit Page option. Click it:
By editing the page, you will see the Web Part option page, click it as below:
By clicking Web Part option, you will see a list of web parts that can be used here. Now select Media and Content and the Content Editor and click Add as below
Now you need to click inside the Content Editor so that you can see Edit Source option on the top ribbon. You need to click this Edit Source link. Please see as below:
After clicking it, a new window will open where you can write HTML Source Code, you need to delete what is written there and paste a new code that I will share with you in a while. First delete all the lines.
Now the delicate part comes, you need to paste the below code in this window:
=======START=========== [NOTE: DONT PASTE THIS, START FROM BELOW]
//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
$[document].ready[function[]{
$Text = $[td .ms-vb2:contains[Approved]].filter[function[] {
return $[this].text[] == Approved;}]
$Text.parent[].css[background-color, #00FF66];
$Text = $[td .ms-vb2:contains[Decline]];
$Text.parent[].css[background-color, #FF0000];
}];
===========THE END========== [NOTE: DONT PASTE THIS, ONLY TILL ABOVE WHERE IT IS WRITTEN AS ]
You need to change the path in Line 1, where it is written//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
type=text/javascript
You need to paste the address of the library where you have kept it, within SharePoint.
After pasting the code, click Add and it will take you back on the list page in Edit Mode as below.
Click Stop Editing.
Now everything is done, lets try it. Input one record and put its Status as Approved and click Save .
Voila! you can see the color is Green. For any record whose Status is Approved will turn green. In this case I have Approved Sherlock Holmes leave request so its coming as green.
Lets input few more records and see results.
In this way you can add colors to your rows, if you want different colors simply change the hexadecimal code of the color.
Reference://www.computerhope.com/htmcolor.htm
try this and do message me if you face any issue.
Best of Luck.
Share this:
Related
- Cascading Drop Downs in SharePoint using InfoPath
- January 5, 2016
- In "SHAREPOINT"
- Deploying Document Centre in SharePoint Online with Content Organizer Feature
- March 26, 2015
- In "SHAREPOINT"
- Contract Management System in SharePoint?
- October 23, 2015
- In "SHAREPOINT"