Skip to content
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

bug(Sort Header): Sort only works if columns are updated #19467

Closed
piltorious opened this issue May 28, 2020 · 3 comments · Fixed by #19492, cayacdev/cashbox#88, ToWipf/jasmarty#155 or CarlosPavajeau/Kaizen#251
Assignees
Labels
area: material/sort P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@piltorious
Copy link

piltorious commented May 28, 2020

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-ivy-o298jy

Steps to reproduce:

  1. Create a material table with mat-sort directive (3 columns will do)
  2. Add any data
  3. Trigger event to apply sort through [matSortActive] and [matSortDirection]
  4. Trigger another event to change the sort using the same bound string objects, do not update the displayed columns

Reproduce via demo:
In the demo you can sort initially with the "Sort by age" button, pressing "Sort by name" fails to apply the sort to the name column as coded. If you hit Reset then "Sort by name" it works fine because the displayedColumns have been changed.

Expected Behavior

The sort should change from the first column sorted to the new one.

Actual Behavior

The sort icon either goes away or does not change from the first column.

Environment

  • Angular: 9.1.9
  • CDK/Material: 9.2.4
  • Browser(s): Chrome 80
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10
@piltorious piltorious added the needs triage This issue needs to be triaged by the team label May 28, 2020
@andrewseguin
Copy link
Contributor

Thanks for the detailed reproduction - this definitely seems like a bug

@andrewseguin andrewseguin added area: material/sort P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels May 28, 2020
@crisbeto crisbeto self-assigned this May 31, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue May 31, 2020
Fixes the visible state of the sort header not being updated if it gets changed through the `matSortActive` binding.

Fixes angular#19467.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 15, 2020
Fixes the visible state of the sort header not being updated if it gets changed through the `matSortActive` binding.

Fixes angular#19467.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 15, 2020
Fixes the visible state of the sort header not being updated if it gets changed through the `matSortActive` binding.

Fixes angular#19467.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 24, 2020
Fixes the visible state of the sort header not being updated if it gets changed through the `matSortActive` binding.

Fixes angular#19467.
@piltorious
Copy link
Author

I appreciate all the work to get this fixed. Any idea on when it will be completed?

crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 27, 2020
…gh binding

Fixes the visible state of the sort header not being updated if it gets changed through
the `matSortActive` binding.

Fixes angular#19467.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 13, 2021
…gh binding

Fixes the visible state of the sort header not being updated if it gets changed through
the `matSortActive` binding.

Fixes angular#19467.
annieyw pushed a commit that referenced this issue Mar 7, 2021
…gh binding (#19492)

Fixes the visible state of the sort header not being updated if it gets changed through
the `matSortActive` binding.

Fixes #19467.

(cherry picked from commit ca7d379)
annieyw pushed a commit that referenced this issue Mar 7, 2021
…gh binding (#19492)

Fixes the visible state of the sort header not being updated if it gets changed through
the `matSortActive` binding.

Fixes #19467.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.