I would like to know how to display a vertical scroll bar for the rows only (headers are not moving) with Angular Material mat-table. When I set overflow: auto
and max-height
in mat-table
style, the whole table (including the headers) are scrolled.
Thanks for your help.
Asked
Active
Viewed 1.9k times
5

r0-
- 2,388
- 1
- 24
- 29

corleone88
- 161
- 2
- 2
- 9
1 Answers
15
You may use the sticky property of MatHeaderRowDef:
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>

GCSDC
- 3,138
- 3
- 28
- 48
-
2@corleone88 glad it helps. If it solved the problem, please accept the answer. – GCSDC Mar 21 '19 at 13:27
-
Note that fixing the table.mat-table height or max-height didnt work for me, had to fix the parent container to a fixed height, and that trick works! – Pipo Mar 20 '23 at 13:54