Skip to content

MatTable with multiTemplateDataRows (expandable) stops working after sorting  #13835

@adgoncal

Description

@adgoncal

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Sorting the table should not cause expansion of secondary template row to stop working

What is the current behavior?

After changing the sort order, the rows that "move up" in the array can no longer toggle secondary template row expansion.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-uy3mc4?file=app%2Ftable-sorting-example.html

  1. On initial load, verify that clicking a row toggles the expansion of its secondary template row.
  2. Sort by "Name" once by clicking the "Name" sort header.
  3. Verify if clicking a row toggles the expansion of its secondary template row.
    The following rows stop working:
    • 4 Beryllium
    • 5 Boron
    • 6 Carbon
    • 9 Fluorine
    • 2 Helium
    • 10 Neon
  4. Sort the table again and all rows stop working.

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

The StackBlitz is running Angular 7, but I first noticed the issue using Angular 6.
MacOS High Sierra 10.13.6
Chrome Version 69.0.3497.100 (Official Build) (64-bit)
Firefox 63.0 (64-bit)

Is there anything else we should know?

This issue may be related to #7767

I have accidentally discovered that, on Firefox, clicking the non-working row exactly 3 times causes it to work again. This is not true for Chrome, which never resumes the original behavior. What sorcery is this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions