Colouring a row in a Sharepoint list
By Devil Scorpio
Consider a list that has a column for status which can be either "Completed" or "InProgress'".We might need to update the row with a color that shows green when the item's status is completed or orange if its in progress.To implement this in sharepoint, we need to create a content editor web part in the same page where list exits, and add the javacript code in content editor web part to perform the same.
Description
Consider a list that has a column for status which can be either "Completed"
or "InProgress'".We might need to update the row with a color that
shows green when the item's status is completed or orange if its in progress.To
implement this in sharepoint, we need to create a content editor web part in
the same page where list exits, and add the javacript code in content editor
web part to perform the same.
Problem this article addresses
Updating a row of a list with particular color.
Code Snippet
<script type="text/javascript">
if(typeof jQuery=="undefined"){
var
jQPath="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/";
document.write("<script
src='",jQPath,"jquery.min.js' type='text/javascript'><\/script>");
}
</script>
<script>
$(document).ready(function(){
$Text = $("td .ms-vb2:contains('Completed')");
$Text.parent().css("background-color",
"green");
$Text =$("td .ms-vb2:contains('InProgress')");
$Text.parent().css("background-color",
"orange");
});
</script>
Popularity (1085 Views)
Article Discussion: Colouring a row in a Sharepoint list