Angular 6 Material Data Table with Fixed Header and Paginator

前端 未结 6 1349
我在风中等你
我在风中等你 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:19

    You can use a normal sticky mat-footer-row with colspan and put the paginator inside:

    
       ...
    
        
            

    And use some style like this, to make it more appealing to eye:

    .mat-row:last-child td {
      border-bottom: none;
    }
    
    .mat-footer-row:first-child td {
      border-top: 1px solid rgba(0, 0, 0, 0.12);
    }
    
    .mat-footer-cell .mat-paginator {
      margin-left: -24px;
      margin-right: -24px;
    }
    

提交回复
热议问题