angular / angular/components

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

Abierto
#27,040 1 comentario 1 reacción 0 asignados Ver en GitHub
area: cdk/table P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el ejemplo de la tabla con ajuste de línea y su reproducción en StackBlitz; después, compara el comportamiento con y sin el elemento mat-text-column. Reproduce el error de registro en Angular 16 y verifica que la tabla con ajuste de línea se renderice correctamente con MatTextColumn y con la columna de símbolos presente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.