angular / angular/components

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

Ouverte
#27,040 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
area: cdk/table P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par l’exemple de tableau avec retour à la ligne et sa reproduction dans StackBlitz, puis comparez le comportement avec et sans l’élément mat-text-column. Reproduisez l’erreur d’enregistrement dans Angular 16 et vérifiez que le tableau avec retour à la ligne s’affiche correctement avec MatTextColumn et que la colonne de symboles est présente.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.