Skip to content
This repository was archived by the owner on Feb 17, 2019. It is now read-only.
This repository was archived by the owner on Feb 17, 2019. It is now read-only.

It's possible to filter numerical values #4

@grahamroy

Description

@grahamroy

If you just change the sort slightly then you can handle numerical values in order rather than the sort by text. This was a real problem for me for someone so thought I would share it with you.

sortOptCallback: function(a, b) {
if( a == b) return 0;
var anum = parseInt(a.val,10);
var bnum = parseInt(b.val,10);
if( isNaN(anum) || isNaN(bnum)) {
return a.text.toLowerCase() > b.text.toLowerCase() ? 1 : -1;
}
return anum > bnum ? 1 : -1;
},

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