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

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

Comments

Projects
None yet
2 participants

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.

Owner

Mottie commented Aug 1, 2012

Thanks! I'll look into this.

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]);
    });
  });
Owner

Mottie commented Sep 27, 2012

Fixed in version 2.4. Sorry for taking so long!

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

@Mottie Mottie closed this Sep 27, 2012

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