Support inserting row/column defs at specific indices rather than always appending
See original GitHub issueWhat 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top GitHub Comments
To clarify, the issue is that you can’t imperatively insert a header row such that it renders above the declarative row?
I couldn’t find any workaround yet.