Skip to content

default sort on page load ignores direction #30

@kickofitall

Description

@kickofitall

A descent sorting on page load seems impossible because of the check for a different column.

The sort function with direction 'desc' still sorts the column in ascending order:
$('table.sortable').tablesort().data('tablesort').sort($("th.default-sort"), 'desc');

Changing the following line fixed that issue for me:
https://github.com/kylefox/jquery-tablesort/blob/master/jquery.tablesort.js#L42

from if (this.index !== th.index()) {
to if (this.index !== null && this.index !== th.index()) {

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions