2

我对 JQuery Datatables 完全陌生,并且我继承了包含分页的 JQuery Datatable 的代码。似乎分页是内置在数据表中的,而无需进行任何显式配置。

现在我的要求是通过告诉 JQuery Datatable NOT TO PAGE 来显示整个表数据

我做了一些谷歌搜索,找不到任何可以将 JQuery 数据表配置为不分页的文档。如果有人知道如何实现这一点,那将不胜感激。

提前感谢您查找我的问题。

4

3 回答 3

5

要取消默认分页(页面大小为 10),我需要再设置一个属性:

"iDisplayLength": -1,

所以最终我的定义看起来像这样:

localTable = $(".classOfTable").dataTable({
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "bStateSave": true,
                "iDisplayLength": -1,
                "sDom": '<"H"Tfr>t<"F"i>',
                "oTableTools": {
                    "sSwfPath": "@Url.Content("~/Scripts/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf")"
                },....

我认为这样做是使显示大小(要显示的记录数)无限,因此不会出现寻呼机控件。

于 2013-07-19T09:26:16.953 回答
1
于 2013-07-13T13:22:02.753 回答
0

I have added the smartness features on the the DataTables JS lib file. to act your tables more smarter that the existing one .. I have made a functionality to remove the Search Bar, Pagination's and Show entries when the table have the records lesser than equal to 10. However it will show the # of entries at the bottom to make the end user to understand the reason behind the tables smartness.. you can add the below code to your Datatables.JS lib file to make your tables more smarter.. search for "fnDrawCallback" and add the dynamic function..

fnDrawCallback: function(e) {
    e.aoData.length > e._iFiltersDisableRowMaxLength ? 
    ($("div#" + e.sTableId + "_filter").parent().show(), 
     $("select[aria-controls='" + e.sTableId + "']").parent().show(), 
     $("div#" + e.sTableId + "_info").parent().show(), 
     $("div#" + e.sTableId + "_length").parent().show()) : 
    ($("div#" + e.sTableId + "_filter").parent().remove(), 
     $("select[aria-controls='" + e.sTableId + "']").parent().remove(), 
     $("div#" + e.sTableId + "_info").next().remove(), 
     $("div#" + e.sTableId + "_length").parent().remove())
}

add the setting variable _iFiltersDisableRowMaxLength: 10 under DataTable.models.oSettings

this code will help you to add the smartness through out the site where ever you use the data-tables.

于 2016-01-27T15:03:54.323 回答