Skip to content


sorton event seems to completely ignore sort direction #127

somewhatdog opened this Issue · 3 comments

2 participants


I've been messing around with this for a while but I cannot, for the life of me, get tablesorter sorton events to pay any attention to the requested sort direction.

This run with various values in col/col2 and 0/1 in dir/dir2

$("#myTable").trigger("sorton",[[[col,dir],[col2,dir2]],function() {alert("sort done")} ]);

All sort and call the alert but ALWAYS sorting the columns in reverse order - I've tried this with alpha and numeric columns - it just doesn't work.

Am I missing something really obvious here??

Clicking column headings works, of course - as does asking for a forward/reverse sort in the setup.


and just as I hit enter I have an idea and...

The problem is that my code is passing variables into the array - and the 'direction' variable is a string and not a number - so "0" and not 0

I guess it's testing the contents for true/false and "0" is true (1) and thus sorts backwards.

A parseInt() fixed it - it MIGHT be worth throwing one of those into the code, but that's clearly an enhancement request...

slaps head


Good catch! I'll include a fix in the next update.


Cool - was driving me mad until I pressed enter here!! :)

Just to let you know, you're powering my Greenlight LITE app (something I wrote which monitors a new part of the SteamPowered Game Distribution service) - 4-6000 hits a day, all sorted with style :)

@Mottie Mottie closed this in a9dd830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.