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

Multi-columns-sorting works only after the first manual sorting #1585

Closed
automatix opened this issue Sep 10, 2018 · 3 comments
Closed

Multi-columns-sorting works only after the first manual sorting #1585

automatix opened this issue Sep 10, 2018 · 3 comments

Comments

@automatix
Copy link

automatix commented Sep 10, 2018

Hello!

Following scenario: I have a table with columns A, B, C, and D. All the columns excepting the C are sortable. The Default sorting is: D [DESC], A [ASC] . Working fine. But now I want to add a further column (D) to the sorting (SCHIFT + click on the column's head).

Expected behavior: The primary and the secondary sorting remain as they are. A tertiary sorting (by D) is added. The table is sorted by three columns.

Observed behavior: The primary and the secondary sorting get reset. The table is now sorted only by the column D.

My code:

$(function () {
    $("#content .table").tablesorter({
        textExtraction: function (node, table, cellIndex) {
            n = $(node);
            return n.attr('data-normalized') || n.text();
        },
        headers: {
            2: {
                sorter: false
            }
        },
        cancelSelection: true,
        sortList: [
            [3,1], [0,0]
        ],
        widgets : ['columns'],
        widgetOptions : {
            columns : ['primary', 'secondary', 'tertiary'],
            columns_thead : true,
            columns_tfoot : true
        }
    });
});

For me it seems to be a bug, but maybe it's just about configuration?..

Best regards,
Ilya

@Mottie
Copy link
Owner

Mottie commented Sep 10, 2018

Hi @automatix!

Thanks that looks like a bug! I found a work-around until I get some time to fix the code base. Add the following code (demo):

initialized: function(table) {
  table.config.last.sortList = table.config.sortList;
}

@automatix
Copy link
Author

Thank you very much!

@Mottie
Copy link
Owner

Mottie commented Sep 10, 2018

Fixed in the master branch... I'll include it in the next update.

Mottie added a commit that referenced this issue Nov 20, 2018
@Mottie Mottie removed the Next Update label Dec 1, 2019
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