本文介绍了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.
我的datatable init:
My datatable init:
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();
}
});
推荐答案
尝试这个: / p>
try this:
$("#myDataTable").dataTables({
"bJQueryUI":true,
"bSort":false,
"bPaginate":true,
"sPaginationType":"full_numbers",
"iDisplayLength": 10
});
这篇关于jQuery Datatables分页设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!