Skip to content

Can't sort column of float values? #41

@connerxyz

Description

@connerxyz

Here's my code to sort a column of float values. It continues to be sorted as if they're strings though. The table simply has <thead>...<th>amount</th></thead>, no class or id or anything.

Thanks in advance for any insight.

$(document).ready(function() {
    $('table').tablesort()
    $('thead th.amount').data(
        'sortBy', 
        function(th, td, tablesort) {
            return parseFloat(td.text());
        }
    );
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions