AngularJS ng-table fixed headers

前端 未结 3 1249
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 04:46

I\'m using ng-table to display some information. I would like to make the header and footer of the ng-table fixed and force the ng-table to draw scroll bars within the rows.

3条回答
  •  深忆病人
    2021-01-31 05:44

    this CSS-only solution worked for me. Just add the class table-scroll to the table element and the following CSS:

    .table-scroll thead {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .table-scroll tbody {
        max-height: 150px;
        overflow-y: auto;
        display: block;
        width: 100%;
        table-layout: fixed;
    }
    
    .table-scroll tr {
        display: table;
        table-layout: fixed;
        width: 100%;
    }
    
    .table-scroll td {
        height: 47px; // needed in order to keep rows from collapsing
    }
    

提交回复
热议问题