DataTable : How to hide the pagination and only show it as need?

后端 未结 6 1417
耶瑟儿~
耶瑟儿~ 2021-02-13 01:51

I have 2 tables that are using DataTable jQuery Plug-in. I wondering if there is a way to hide my pagination on the bottom right of my table.

6条回答
  •  旧巷少年郎
    2021-02-13 02:13

    Use drawCallback option to handle DT draw event and show/hide pagination control based on available pages:

    $('#table_id').dataTable({
      drawCallback: function(settings) {
        var pagination = $(this).closest('.dataTables_wrapper').find('.dataTables_paginate');
        pagination.toggle(this.api().page.info().pages > 1);
      }
    })
    

提交回复
热议问题