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

后端 未结 6 1419
耶瑟儿~
耶瑟儿~ 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:16

      $('#dataTable_ListeUser').DataTable( {
    
            //usual pager parameters//
    
            "drawCallback": function ( settings ) {
    
            /*show pager if only necessary
            console.log(this.fnSettings());*/
            if (Math.ceil((this.fnSettings().fnRecordsDisplay()) / this.fnSettings()._iDisplayLength) > 1) {
                $('#dataTable_ListeUser_paginate').css("display", "block");     
            } else {                
                $('#dataTable_ListeUser_paginate').css("display", "none");
            }
    
            }
           });
    

提交回复
热议问题