tablesorter jQuery hack
I'm trying to hack the tablesorter j开发者_如何转开发Query plugin with no success. What I'm wanting is this...
I have a table (list of sports teams) and a row is set to a specific class. This basically is to show qualificatoin for finals series, so it must always STAY in that place. eg. if someone sorts the table by wins, I still want the 8th row to have the class I gave it at the start with this:
$("table.ladder tr:nth-child(8)").addClass("finals");
As tablesorter is at the moment, when the table is sorted, this TR obviously moves around. What's the best way to make tablesorter KEEP the nth row like this?
Hope this makes sense!!
tableSorter has a under-documented internal function called 'sortEnd' that you can bind to...
$("table.ladder")
.tablesorter()
.bind("sortEnd", function(){
$("table.ladder tr").removeClass("finals");
$("table.ladder tr:nth-child(8)").addClass("finals");
})
I'm assuming you only want to move the class, and not the data. if you have a data row that is always supposed to be at the bottom, you can use the <thead/><tbody/><tfoot/>
structure and place that row in <tfoot/>
精彩评论