I have some tables which use the jQuery plugin 'tablesorter' to allow easy sorting. Recently, I found out that it included a zebra striping widget. I enabled it, and it's been working well.
I also decided to add the 'Sieve' plugin, as an alternative to the existing, homebuilt table search function, and that's where my problem arose - the striping is not redone during or after the search, leaving the table uneven and mismatched.
Thus far, I haven't been able to find a way to make it manually refresh, and I'm not sure where I would put it if I had - in the sieve .js file? Is there a way to make these two plugins play nice with each other?
If you want to use the Sieve plugin, this code will work with either the original version of tablesorter or my fork of tablesorter (demo):
$(function () {
var $table = $('table');
$table
.tablesorter({
widgets: ['zebra']
})
.sieve({
complete: function(){
// update the zebra widget after Sieve completes
$table.trigger('applyWidgets');
}
});
});