components
components copied to clipboard
fix(material/table): sorting column breaks if contains a number with zero left
Fix https://github.com/angular/components/issues/20140 that when sorting column breaks if one or more record contains a number with zero left. This is specifically happen when the value is a number with zero left(ex: '0123'), so the funcion "_isNumberValue" understand this like a number and then the value is convert to 123. The approach i used was to return the default value only in this specific case.
The original issue doesn't appear to be a problem in v14: https://stackblitz.com/edit/angular-elb4wq?file=src%2Fapp%2Ftable-sorting-example.ts
I believe the remaining issue here is that the function doesn't do well to sort an array with both numbers and arrays. Can you confirm this is an issue if the array has a consistent type, e.g. all strings?
Hey andrew @andrewseguin, this is a bit most specific, check with this data https://stackblitz.com/edit/angular-elb4wq-bbrdge?file=src%2Fapp%2Ftable-sorting-example.ts, i think the "06' should be on the first place, this is happening because '06' is a number with zero left
yeah it does seem like something is off, but I'm trying to determine what the best solution is - I tried testing this internally and there was a failure, and I'll need to see why that is. Thanks for your patience, trying to make sure this stays prioritized
No problems Andrew, i remain available if needed.