Reputation: 68790
I'm using datatables that adds pagination at the end of the table. But I want to show the pagination controls only when required, not when there're just a couple of rows. I can't find anywhere to control this.
$('#tblSubscriptions').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "GET",
"aaSorting": [[0, 'asc']],
"sAjaxSource": "<?php echo base_url() . 'data/grid/' . $website['WebsiteId']; ?>",
"aoColumns": [
null,
null,
null,
{ "bSortable": false },
{ "bSortable": false },
{ "bSortable": false },
{ "bSortable": false }],
"bFilter" : false,
"bInfo" : false,
"sPaginationType": "two_button"
});
Upvotes: 1
Views: 108
Reputation: 2941
You can add this in the parameters as well to achieve what you want.
"fnDrawCallback": function(oSettings) {
if ($('#tblSubscriptions tr').length < 11) {
$('.dataTables_paginate').hide();
}
}
Upvotes: 2