Jquery DataTable一次显示所有OR 50记录,而Metronic管理主题中没有任何分页

时间:2015-01-08 04:35:27

标签: jquery jquery-datatables

我已经在我的HTML文件

下以这种方式配置了表格
<table class="table table-striped table-bordered table-hover table-full-width" id="sample_2">
   <thead>
      <tr>
         <th class="hidden-480">BuySell Difference</th>
         <th class="hidden-480">Stock</th>
         <th class="hidden-480">LP</th>
      </tr>
   </thead>
   <tbody>
   </tbody>
</table>

我在table_managed.js文件下有这个东西

 $('#sample_2').dataTable({
            "aLengthMenu": [
                [5, 15, 20, -1],
                [5, 15, 20, "All"] // change per page values here
            ],
            // set the initial value
            "iDisplayLength": 5,
            "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
            "sPaginationType": "bootstrap",
            "oLanguage": {
                "sLengthMenu": "_MENU_ per page",
                "oPaginate": {
                    "sPrevious": "Prev",
                    "sNext": "Next"
                }
            },
            "aoColumnDefs": [{
                    'bSortable': false,
                    'aTargets': [0]
                }
            ]
        });

现在它首先只显示前10条记录。当我在下拉列表中选择ALL时,它会显示所有记录。

        How can i make display all records at once without any pagination initially??

1 个答案:

答案 0 :(得分:1)

尝试将"iDisplayLength": 5更改为"iDisplayLength": -1