See http://jsfiddle.net/RPHA7/.
I’m using jQuery tablesorter.
In the jsfiddle, there are two columns (Colors and Animals) that begin in an unsorted state. When you click on “Colors”, it sorts by that column in ascending order (Blue, Green, etc…). If you then click on “Animals”, it sorts by that column also in ascending order (Aardvark, Dolphin, etc…). If you then click on “Colors” a second time, it sorts it in descending order (Red, Purple, etc…).
This seems counter-intuitive. I would expect it to toggle ascending/descending only if you click on the same column over and over. Clicking on a different column should always start the sort for that column in ascending order, regardless of any prior state.
Is there a setting in jQuery tablesorter (or some hack) to make it work like this?
ok you have to add a few lines in the jquery.tablesorter.js:
on line 727 you should have :
this.order = this.count++ % 2;just after it insert the following lines:
That’s it 🙂