I took an html table that I am applying alternative row colors to, and I added jquery table sorter on it so users can sort the table.
The issue is that the alternati
In order to maintain the zebra stripes after a sort has taken place you need to trigger the zebra widget again.
$('#myTable')
.tablesorter({ widgets: ['zebra'] })
.bind('sortEnd', function(){
$("#myTable").trigger("applyWidgets");
});
This is less of a hack, as you will be reusing the logic of the zebra widget rather than replicating it.
Note: This kind of work-around is only required in instances where the default zebra widget is failing. I have found in most circumstances that this hack is not required as the widget is operating correctly post sort.