Skip to content

bug(material/table): Using mat-text-column within wrapped table doesn't work #27040

Open
@jsarem

Description

@jsarem

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Extending wrapped table example from documentation with mat-text-column component causes whole table to break. The MatTextColumn component cannot find the material table to register to.

<wrapper-table ...>
  <!-- Custom column that doesn't work -->
  <mat-text-column name="symbol"></mat-text-column>
</wrapper-table>

Reproduction

See fork of the wrapped table example on Stackblitz: https://stackblitz.com/edit/3yrpgj-hxvvce

See console for errors. The table doesn't render properly until "symbol" column is removed from displayedColumns array.

Expected Behavior

I would expect that using custom column definitions like the MatTextColumn would work with wrapped material table. However fixing this may turn out to be impossible due to how ng-content and componen initialization works.

Actual Behavior

Adding the mat-text-column column within wrapped Material table throws an expection:

Error: Text column could not find a parent table for registration.
   ...

Environment

  • Angular: 16.0.0
  • CDK/Material: 16.0.0
  • Browser(s): Google Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/table

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions