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

Column to have asc/reset sort direction, rest colums asc/desc/reset direction #1137

Closed
Murmur opened this issue Jan 22, 2016 · 5 comments
Closed

Comments

@Murmur
Copy link

Murmur commented Jan 22, 2016

I have one column where SortByASC or Reset(nosort) are only sane options, DESC is not required. Remaining columns may use Asc/Desc/Reset options. I could not find attributes to do it. Possible?

@Mottie
Copy link
Owner

Mottie commented Jan 22, 2016

Hi @Murmur!

Set a lockedOrder value inside the headers option.

@Murmur
Copy link
Author

Murmur commented Jan 25, 2016

Sort of works. I was trying to have double-arrow,down-arrow,double-arrow state changes. Using a lockedOrder prop it goes double-arrow,down-arrow,(sticked to desc). I cannot reset an ordering anymore. Tried giving multiple values of allowed sorting state but failed. Same applies to "asc" value.

  ,headers: {
    0: { lockedOrder:"desc" }
  } 

@Mottie
Copy link
Owner

Mottie commented Jan 25, 2016

Ok, try this instead (demo)

$(function() {
  $('table').tablesorter({
    theme: 'blue',
    initialized: function(table){
        table.config.sortVars[0].order = [ 1,2 ];
    }
  });
});

@Mottie Mottie added the Demo label Jan 25, 2016
@Murmur
Copy link
Author

Murmur commented Jan 25, 2016

That was a hidden secret. I do see a weird side effect if sortReset:true attribute was also given, nosort state is toggled twice in a row. Column's sorting state is double-arrow,down-arrow,double-arrow,double-arrow,down-arrow instead of double-arrow,down-arrow,double-arrow,down-arrow,...
http://jsfiddle.net/856bzzeL/856/

@Mottie
Copy link
Owner

Mottie commented Jan 25, 2016

Yeah, I'm not sure how to fix that... when sortReset is false there are only two order states. When true, there are three states: asc, desc and reset... hard to make a locked column sort one direction and reset when the sortReset is looking for three states.

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

2 participants