Components: [MatSort] sort function doesn't render sorting arrow

Created on 4 Apr 2019  路  5Comments  路  Source: angular/components

What is the expected behavior?

sort function in MatSort should update sorting arrow rendering state.

What is the current behavior?

Currently sort function in MatSort not updating sorting arrow rendering state.

What are the steps to reproduce?

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.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All

Is there anything else we should know?

P3 materiasort good first issue help wanted

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

sortByNameFixed() {
    const sortHeader = this.sort.sortables.get('name');
    sortHeader['_handleClick']();
  }

All 5 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

savaryt picture savaryt  路  3Comments

dzrust picture dzrust  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments

3mp3ri0r picture 3mp3ri0r  路  3Comments

LoganDupont picture LoganDupont  路  3Comments