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);
});
});
Solution 2:
Use sDom
option. Try sDom: 'ft'
option. It's work for me.
Take a look here: http://datatables.net/usage/options#sDom
Post a Comment for "How To Disable Datatables Paging After Initialization?"