angular / angular/components

Support inserting row/column defs at specific indices rather than always appending

Ouverte
#21,791 7 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
area: cdk/table feature P4
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### What are you trying to do?

I'm trying to make table with 2 sticky header rows. First row should contain toolbar with table actions, but definition of this row is in separated file, it is passed through `cdkTable.addHeaderRowDef` . Second row should contain descriptions of columns.

#### What troubleshooting steps have you tried?

I tried to manually position `headerRowDefinition` inside `_headerRowDefs` property, but I'm unable to do that due to:
https://github.com/angular/components/blob/d3deb8b9c61f79f6a4ab75d74914aac3b43592bf/src/cdk/table/table.ts#L895
contentHeaderRowDefinitions specified explicit as content are always before customHeaderRowDefinitions added via `addHeaderRowDef`.

I tried to handle stickness by styling headers `postion: sticky` and calculate top positioning, but I'm unable to do that due to: https://github.com/angular/components/blob/d3deb8b9c61f79f6a4ab75d74914aac3b43592bf/src/cdk/table/table.ts#L731
All header rows have cleared top positioning value that I set via styling.

#### Reproduction
https://stackblitz.com/edit/angular-bkarpk?file=src/app/table/table.component.html

#### Environment

- Angular: 11.1.1
- CDK/Material: 11.1.1
- Browser(s): Chrome/Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par les sections liées de src/cdk/table/table.ts et exécutez la reproduction StackBlitz fournie. Suivez la façon dont le contenu et les définitions personnalisées de lignes d’en-tête sont ordonnés, ainsi que la façon dont le positionnement fixe de l’en-tête est supprimé. Le travail est terminé lorsque les définitions d’en-tête peuvent apparaître à l’index demandé et que les deux lignes d’en-tête fixes conservent un positionnement correct.

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

Évaluation

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

Recevez les nouvelles issues par e-mail

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