Change the number of displayed rows in jQuery datatable

后端 未结 4 592
南旧
南旧 2021-01-05 05:11

Why the number of rows in jquery datatable (see the code below) is not set to 5? It is equal to 10 8as by default). Why \'iDisplayLength\': 5 does

4条回答
  •  花落未央
    2021-01-05 05:46

    This is definetely the easiest way I found:

    var oTable;
    
    $(document).ready(function() {
        $('.some-button').click( function () {
            var oSettings = oTable.fnSettings();
            oSettings._iDisplayLength = 50;
            oTable.fnDraw();
        });
    
        oTable = $('#example').dataTable();
    });
    

提交回复
热议问题