Skip to content

Instantly share code, notes, and snippets.

@SriharshaShesham
Last active September 25, 2015 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SriharshaShesham/e02437d55e0975864e08 to your computer and use it in GitHub Desktop.
Save SriharshaShesham/e02437d55e0975864e08 to your computer and use it in GitHub Desktop.
<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