angular-tablesort icon indicating copy to clipboard operation
angular-tablesort copied to clipboard

Natural sort (alphanumeric)

Open djensenius opened this issue 8 years ago • 3 comments

It would be nice to have the option to have alphanumeric sorting so items like:

MUSIC 1 MUSIC 2 ... MUSIC 10

Don't show up as

MUSIC 1 MUSIC 10 MUSIC 2

djensenius avatar Sep 23 '16 16:09 djensenius

You can always add one more field to the entries in the array and sort on that even though you still display something else. Example:


vm.items = [
    { title: "MUSIC 1", sortKey: "MUSIC001" },
    { title: "MUSIC 10", sortKey: "MUSIC010" }
]

Display title on the page, but sort on sortKey when the user clicks the title-column.

mattiash avatar Oct 12 '16 19:10 mattiash

+1 for this issue. Natural sort is a common problem, it would be nice if this could be done by default.

Ugoku avatar Nov 30 '16 14:11 Ugoku

You can use filters in ts-criteria expression for converting values to a sortable representation: <th ts-criteria="title | asSortable"></th>

Anber avatar Feb 16 '18 14:02 Anber