-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Natural Sorting in Material table #12059
Comments
@rohitkrishna12 I can't reproduce the issue in your example. Here's what I get when I sort by weight: |
@crisbeto 2015-410 should follow with 2015-510 then 2015-4110 and same in case of 2016 the values are not sorted correctly. Please verify. |
@rohitkrishna12 Idk what you are expecting, but I guess, as your weight data are in strings, the screenshot of @crisbeto is totally correct: If you want another sorting method, you have to implement it yourself or display another set of data (data in numbers for instance and displaying this format with a pipe) |
@bmercier-manakin i think i got this figured out by implementing custom sort algorithm by overrding sortData method from the MatTableDataSource class. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Table to sort correctly alphanumeric characters within a column.
What is the current behavior?
Incorrectly sorts the data when alphanumeric characters are involved.
StackBlitz Example to reproduce the issue: https://stackblitz.com/edit/angular-zuxhe4
What is the use-case or motivation for changing an existing behavior?
To display sort results correctly in the table.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 6
Material 6.3.2
OS Windows 10
Typescript 2.9.2
Browsers - All
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: