jQuery Datatables 分页设置 [英] jQuery Datatables pagination setting

查看:28
本文介绍了jQuery Datatables 分页设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试处理 jquery 数据表的分页.我用ajax加载数据.我现在的回复是:

I'm trying to work with the pagination of the jquery datatables. I load the data with ajax. My response is now:

aaData: [[:anonymous:, null, 2012-07-29 08:28:21, 0, 85 million, null],…]
iTotalDisplayRecords: 70
iTotalRecords: 70
sEcho: 1

我的所有记录 (70) 都显示出来了,我怎样才能让它们分页并且每页有 10 条记录?

All of my records (70) are shown, how can I make them paginate and have for ex 10 records per page?

我尝试将 iTotalDisplayRecords 设置为 10,但它显示了相同的结果.

I tried settings iTotalDisplayRecords to 10 but it shows the same result.

我的数据表初始化:

myDataTable = $('#datatablesresults').dataTable({
    bProcessing  : true,
    sProcessing  : true,
    bServerSide  : true,
    sAjaxSource  : '/results/load-results?' + getParams,
    aoColumnDefs : [{'bSortable' : false, 'aTargets' : ['no-sort']}], // make the actions column unsortable
    sPaginationType : 'full_numbers',
    fnDrawCallback  : function(oSettings) {
        _initTable();
    }
});

推荐答案

试试这个:

$("#myDataTable").dataTables({
     "bJQueryUI":true,
      "bSort":false,
      "bPaginate":true,
      "sPaginationType":"full_numbers",
       "iDisplayLength": 10
});

这篇关于jQuery Datatables 分页设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆