sorton event seems to completely ignore sort direction #127

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

Comments

Projects
None yet
1 participant
@ghost

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

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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

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

This comment has been minimized.

Show comment
Hide comment
@Mottie

Mottie Sep 3, 2012

Owner

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

Owner

Mottie commented Sep 3, 2012

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

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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

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 in a9dd830 Sep 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment