仅在需要时显示分页

时间:2013-03-28 05:51:32

标签: jquery ajax pagination datatables

我使用datatables在表格末尾添加分页。但我想仅在需要时显示分页控件,而不是仅在几行时显示分页控件。我找不到任何可以控制它的地方。

$('#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"
});

1 个答案:

答案 0 :(得分:2)

您也可以在参数中添加它以达到您想要的效果。

"fnDrawCallback": function(oSettings) {
    if ($('#tblSubscriptions tr').length < 11) {
        $('.dataTables_paginate').hide();
    }
}
相关问题