sort function in MatSort should update sorting arrow rendering state.
Currently sort function in MatSort not updating sorting arrow rendering state.
https://stackblitz.com/edit/angular-cfcugl-17fxat
If you click "sort by name" button you will see this bug.
"Sort with fix" button shows the easiest way to fix this bug.
All
@jelbourn If no one is working on this, perhaps I can give it a go next weekend or so? :)
@jysoo go for it
@jysoo The solution you proposed doesn't work properly for me, when the arrow is supposed to be cleared.
Calling the _handleClick() function, instead, solves it for me. Probably we could have a function on MatSort that basically does what "sortByNameFixed" is doing, provided an id (string) for a sortable
sortByNameFixed() {
const sortHeader = this.sort.sortables.get('name');
sortHeader['_handleClick']();
}
Should MatSort also react to changes to active and direction properties and update sort header arrows state automatically to match the current state? This would be consistent with how paginator behaves.
@jelbourn @andrewseguin May I ask if the team intends to incorporate a fix for this issue some time in the future? (There's a PR #16413) Thanks.
Most helpful comment
@jysoo The solution you proposed doesn't work properly for me, when the arrow is supposed to be cleared.
Calling the _handleClick() function, instead, solves it for me. Probably we could have a function on MatSort that basically does what "sortByNameFixed" is doing, provided an id (string) for a sortable