Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Sharepoint 2013 conditional formatting with Jquery

$
0
0

I'm trying to use conditional formatting of rows in a Sharepoint List.

When a certain value exists in a table row, the row needs to get a different background color, depending on the value.

The code I have works fine, except when I filter the list, with the in place search or when I use a different list filter, the Jquery is no longer applied.

This is the code, I also tried some different events, like document.ready etc. but that also dit not work..

function pageLoad(sender, e) {

$('.ms-itmhover:contains("Available")').css('background-color', 'lightgreen');

$('.ms-itmhover:contains("Not")').css('background-color', 'red');

$('.ms-itmhover:contains("Mobile")').css('background-color', 'lightblue');

$('.ms-itmhover:contains("Holiday")').css('background-color', 'red');

$('.ms-itmhover:contains("Meeting")').css('background-color', 'orange');

}

I hope one of you guys has an idea of what is happening and why the pageload is not triggered after a list is filtered. I thought a ajax call was made and therefore it wasn't working but even with the ajaxcomplete event it didn't trigger.

Any thoughts?

Thanks in advance.

Regards,

Dries


Viewing all articles
Browse latest Browse all 25064


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>