[Table] Negative numbers not sorted correctly
Bug, feature request, or proposal:
A number field, if it's negative, gets sorted after 0 when sorting ascending.
What is the expected behavior?
Negative numbers come before 0 when sorting ascending.
What is the current behavior?
When sorting ascending, negative numbers come after 0 and before positive numbers.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-yfw5ia-uaqsrh?file=app%2Ftable-sorting-example.ts Click on the weight column header one time to sort ascending.
What is the use-case or motivation for changing an existing behavior?
It makes sense that -1 < 0 < 1 and I think the default sort comparison should follow that rule.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material 5.2.2
Anything else
This is using the default sort with MatSort on a MatTable using MatTableDataSource.
I also have this problem. Any fixes?
@aleksanderhan A workaround is to use MatTableDataSource.sortData to override the sort mechanism.
Should be fixed in https://github.com/angular/material2/pull/10561
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.