Angular 6 Material Data Table with Fixed Header and Paginator

前端 未结 6 1367
我在风中等你
我在风中等你 2020-12-18 18:53

How to make the Header of Data Table component fixed to the top, and the Paginator fixed to the bottom?

This is my HTML:

6条回答
  •  情深已故
    2020-12-18 19:11

    I found in the examples on the material site that the header can be fixed by adding sticky to the matHeaderRowDef:

    
    

    For the paginator i added a class to mat-paginator:

     
    

    with a class based on the answer in the link @frederik provided in the comments

    .mat-paginator-sticky {
      bottom: 0px;
      position: sticky;
      z-index: 10;
    }
    

提交回复
热议问题