angular-tablesort
angular-tablesort copied to clipboard
Natural sort (alphanumeric)
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
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.
+1 for this issue. Natural sort is a common problem, it would be nice if this could be done by default.
You can use filters in ts-criteria
expression for converting values to a sortable representation: <th ts-criteria="title | asSortable"></th>