Last active
September 25, 2015 01:17
-
-
Save SriharshaShesham/e02437d55e0975864e08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/JavaScript" src="/2013/MD/Scripts%20%20Styles/Scripts/jquery.min.js"></script> | |
<script type="text/JavaScript"> | |
//alert("test1"); | |
$(document).ready(function() | |
{ | |
var columnName = "Project Status"; // Enter your column name where you want to append the KPI | |
var getProjectStatusColIndex = parseInt($('tr').find('th:contains("'+columnName+'")').index()); | |
var table=$('tr').find('th:contains("'+columnName+'")').closest('table'); | |
//alert(table); | |
table.find('tr').each(function() | |
{ | |
var status=($(this).find('td:eq('+getProjectStatusColIndex+')').text()); | |
switch(status) | |
{ | |
case "Good": | |
{ | |
$(this).find('td:eq('+getProjectStatusColIndex+')').append(' <img src="_layouts/images/KPIDefault-0.GIF"/>'); | |
//img above is a green Cirle | |
} | |
break; | |
case "At Risk": | |
{ | |
$(this).find('td:eq('+getProjectStatusColIndex+')').append(' <img src="_layouts/images/KPIDefault-2.GIF"/>'); | |
//img above is red Diamond | |
} | |
break; | |
case "Need Help": | |
{ | |
$(this).find('td:eq('+getProjectStatusColIndex+')').append(' <img src="_layouts/images/KPIDefault-1.GIF"/>'); | |
//img above is yellow triangle | |
} | |
break; | |
} | |
}); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment