angular / angular/components

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

Aperta
#27,040 1 commento 1 reazione 0 assegnatari Vedi su GitHub
area: cdk/table P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con l’esempio della tabella con testo a capo e la relativa riproduzione in StackBlitz, quindi confronta il comportamento con e senza l’elemento mat-text-column. Riproduci l’errore di registrazione in Angular 16 e verifica che la tabella con testo a capo venga visualizzata correttamente con MatTextColumn e con la colonna dei simboli presente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.