Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorton event seems to completely ignore sort direction #127

Closed
ghost opened this issue Sep 3, 2012 · 3 comments
Closed

sorton event seems to completely ignore sort direction #127

ghost opened this issue Sep 3, 2012 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 3, 2012

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.

@ghost
Copy link
Author

ghost commented Sep 3, 2012

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

@Mottie
Copy link
Owner

Mottie commented Sep 3, 2012

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

@ghost
Copy link
Author

ghost commented Sep 11, 2012

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 :)

http://www.shrewdlogarithm.com/greenlight.htm

@Mottie Mottie closed this as completed in a9dd830 Sep 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant