Skip to content Skip to sidebar Skip to footer

How To Disable Datatables Paging After Initialization?

I have a DataTable with pagination enabled and I need to disable this setting and show all the results without pager by pressing a button. I'm trying to access the already defined

Solution 1:

You should destroy and reinitilize the datatable with bPaginate option set to false on button click

 $(document).ready(function() {
    var table =  $('#example');
    var tableOptions = {
        'bPaginate': true,
        'iDisplayLength': 5
    };
   table.DataTable(tableOptions);
   $('button.destroy_pager').on('click', function() {        
        table.DataTable().destroy()
        tableOptions.bPaginate = false;
        table.DataTable(tableOptions);
    });
});

demo

Solution 2:

Use sDom option. Try sDom: 'ft' option. It's work for me. Take a look here: http://datatables.net/usage/options#sDom

Solution 3:

$('#example').DataTable({
    'bPaginate': false       
});

use the above code.

jsFiddle

Post a Comment for "How To Disable Datatables Paging After Initialization?"