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

sortAppend doesn't work with multicolumn sorting #115

Closed
jakestay opened this issue Aug 1, 2012 · 4 comments
Closed

sortAppend doesn't work with multicolumn sorting #115

jakestay opened this issue Aug 1, 2012 · 4 comments
Labels
Milestone

Comments

@jakestay
Copy link

jakestay commented Aug 1, 2012

sortAppend does not work as expected when doing a multicolumn sort. the appended sort column(s) stick after each column, so when a 2nd column header is clicked, you end up with it being added after rather than before the appended sort column(s).

for example, if sortAppend is [[0,0]], and the user clicks on column 2, then sortList becomes [2,0,0,0], as expected. if the user then clicks on column 3, then sortList becomes [2,0,0,0,3,0,0,0], whereas I would except it to be [2,0,3,0,0,0].

sortAppend would behave more as expected if the appended sort columns were removed from the sortList just before adding additional columns when doing a multicolumn sort.

@Mottie
Copy link
Owner

Mottie commented Aug 1, 2012

Thanks! I'll look into this.

@jakestay
Copy link
Author

jakestay commented Aug 1, 2012

FYI, here's my simple but functional work-around, in case it's helpful:

    $("table.sortable").tablesorter({
//      sortAppend:[[0,0]],   //broken; see sortBegin/sortEnd fix below
    }).bind("sortBegin", function(sorter) {
        // fix: custom sortAppend that plays nice with multicolumn sorts 
        sorter.target.config.sortList.push([0,0]);
    }).bind("sortEnd", function(sorter) {
        // fix: custom sortAppend that plays nice with multicolumn sorts 
        sorter.target.config.sortList.pop([0,0]);
    });
  });

@Mottie
Copy link
Owner

Mottie commented Sep 27, 2012

Fixed in version 2.4. Sorry for taking so long!

@jakestay
Copy link
Author

thank you! it seems to be working as expected now.

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

No branches or pull requests

2 participants