I have the tablesorter from motti and I can't find out a simple way to sort a certain column in more than one way from 2 different hot areas in the same header. (One way via "gamename" and another via "percentage".)
My code already sorts on Game on the gamename, but it does do the same when clicking on percentage (so the latter not by percentage, but by name).
What's the least-code way to do this? (Preferably with existing tablesorter options.)
Table header column:
<th>Game <span class="percSort">%</span></th>
Body column:
<th class="gamename">
<div style="width:66%;background-color: hsla(84,100%,50%,0.7);"></div>
<span class="name">Alphabetic</span>
<span class="perc">66%</span>
</th>
Domready code:
$("#games")
.tablesorter({
sortList: [['.percSort',1]],
textExtraction:{
1:function(node, table, cellIndex) {
return $(node).find('.name').text();
},
'.percSort':function(node, table, cellIndex) {
return $(node).find('.perc').text();
}
}
});
What I cannot do: split my corresponding column in more column. It displays colored bars via the css you can see.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…