angular / angular/components

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

Offen
#27,040 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/table P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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](https://material.angular.io/components/table/examples#table-wrapped) from documentation with `mat-text-column` component causes whole table to break. The `MatTextColumn` component cannot find the material table to register to.

```


```

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem Beispiel für die umgebrochene Tabelle und seiner StackBlitz-Reproduktion. Vergleichen Sie anschließend das Verhalten mit und ohne das Element mat-text-column. Reproduzieren Sie den Registrierungsfehler in Angular 16 und verifizieren Sie, dass die umgebrochene Tabelle mit MatTextColumn und vorhandener Symbolspalte korrekt gerendert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.