ngx-datatable footer customize

徘徊边缘 提交于 2020-01-22 18:00:07

问题


How to customize ngx datatable. I am not able to find, where I have to change the code to get rid of this total number of records and to replace it with a drop down to show items per page. My pagination are missing some icons too.


回答1:


Use the custom footer template ( refer the link below ). so it overrides the default footer.

https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/footer.component.ts

Examples

If you want to just get rid of the footer, simply use:

<ngx-datatable-footer></ngx-datatable-footer>

If you want to customise it:

<ngx-datatable-footer>
  <ng-template
    ngx-datatable-footer-template
    let-rowCount="rowCount"
    let-pageSize="pageSize"
    let-selectedCount="selectedCount"
    let-curPage="curPage"
    let-offset="offset"
  >
    <div style="padding: 5px 10px">
      <div><strong>Summary</strong>: Gender: Female</div>
      <hr style="width:100%" />
      <div>
        Rows: {{ rowCount }} | Size: {{ pageSize }} | Current:
        {{ curPage }} | Offset: {{ offset }}
      </div>
    </div>
  </ng-template>
</ngx-datatable-footer>



回答2:


But if You want change only "total" or "no items found" then overwrite messages property:

//Static messages in the table you can override for localization.
{
  // Message to show when array is presented
  // but contains no values
  emptyMessage: 'No data to display',
  // Footer total message
  totalMessage: 'total'
}

https://swimlane.gitbooks.io/ngx-datatable/api/table/inputs.html



来源:https://stackoverflow.com/questions/43396379/ngx-datatable-footer-customize

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!