javascript JQuery 数据表分页

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4831290/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 15:00:53  来源:igfitidea点击:

JQuery Datatables pagination

javascriptjquerydatatables

提问by glenn

I can't get my pagination to work after I added a date filtering plug-in to datatables. The original code was like this and it was picking up the pagination fine.

将日期过滤插件添加到数据表后,我的分页无法正常工作。原始代码是这样的,它可以很好地分页。

$(document).ready(function() {

 $('#table1').dataTable({
  'sPaginationType': 'full_numbers'
 });

this is my current one with the plug in variables

这是我目前的插件变量

$(document).ready(function() {
 var oTable = $('#table1').dataTable();
 "sPaginationType": "full_numbers"
 /* Add event listeners to the two range filtering inputs */
 $('#min').keyup( function() { oTable.fnDraw(); } );
 $('#max').keyup( function() { oTable.fnDraw(); } );

});

Thanks in advance.

提前致谢。

回答by Colin Brock

Well, in your current function, this part:

好吧,在您当前的功能中,这部分:

var oTable = $('#table1').dataTable();
"sPaginationType": "full_numbers"

should be written like this:

应该这样写:

var oTable = $('#table1').dataTable({
    'sPaginationType': 'full_numbers'
});


Edit

编辑

In case it wasn't clear, the full jQuery code should look like this:

如果不清楚,完整的 jQuery 代码应如下所示:

$(document).ready(function() {
    var oTable = $('#table1').dataTable({
        'sPaginationType': 'full_numbers'
    });
    /* Add event listeners to the two range filtering inputs */
    $('#min').keyup( function() { oTable.fnDraw(); } );
    $('#max').keyup( function() { oTable.fnDraw(); } );
});