Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

Angular Material Table spitted headers add the sticky header functions

I am having the spitted header angular material table and I was looking for help to add the sticky header.

I have tried to using sticky: true but somehow it is not working for my first column (as I am hiding the column.) And for the first rows. It is showing the second row.

Below is my table

enter image description here

When I go with the dropdown only these headers get sticky behavior than others. enter image description here

Below is my stackblitz.

https://stackblitz.com/edit/angular-bklajw-5foa62


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To make the top header sticky add sticky tag in that as well. It will also fixed first column sticky issue.

 <tr mat-header-row
     *matHeaderRowDef="['header-row-first-group','header-row-sec-group','header-row-third-group','header-row-forth-group','header-row-fifth-group'];sticky:true">
</tr>

Demo


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...