Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Last active June 22, 2021 17:32
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 michaellwest/fefb628faceb8ec3ec1e8549cfdc6af6 to your computer and use it in GitHub Desktop.
Save michaellwest/fefb628faceb8ec3ec1e8549cfdc6af6 to your computer and use it in GitHub Desktop.
Highlight rows in a SharePoint list.
<script src=https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js></script>
<script>
jQuery(function() {
function applyStyles() {
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Required')").parent().css('background-color','red');
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Conditionally Required')").parent().css('background-color','blue');
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Additional Services')").parent().css('background-color','yellow');
jQuery(".ms-listviewtable tbody[id*='titl'] > tr > td > span").remove()
}
applyStyles();
jQuery(window).on('hashchange', function() {
applyStyles();
});
var regExp = /ExpCollGroup(.*)\)/
$('.ms-commentexpand-iconouter,.ms-commentcollapse-iconouter').closest('a').each(function() {
$(this).on('click', function() {
applyStyles();
});
});
var _ExpCollGroup = ExpCollGroup;
ExpCollGroup = function (groupName, imgName, evt, noAjax) {
_ExpCollGroup(groupName, imgName, evt, noAjax);
setTimeout(function() {
applyStyles();
}, 500);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment