我有一个包含200多条记录和10多页的数据表。单击下一个和上一个按钮时,分页工作非常完美。但是,当我点击特定页面并尝试转到另一个页面时,我会收到并发出问题(例如:点击1页然后点击第5页)。它显示处理消息,没有任何反应。
我在控制台上收到此错误:
var oTable = $('#trip_infor_tbl').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource":"trip/infor",
"paging": true,
"language": {
"emptyTable": "No rejected entries available in table",
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
"infoEmpty": "Showing 0 to 0 of 0 entries",
"infoFiltered": "",
"infoPostFix": "",
"lengthMenu": "Show _MENU_ entries",
"loadingRecords": "Loading...",
"processing": "Processing...",
"search": "Search:",
"zeroRecords": "Select a batch number from the above list",
"paginate": {
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last"
},
"aria": {
"sortAscending": ": activate to sort column ascending",
"sortDescending": ": activate to sort column descending"
},
"decimal": "",
"thousands": ","
},
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback,
"error": function (e) {
}
});
if(oSettings._iDisplayLength != -1) {
page_no = Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength );
selectall.push(new Array());
}
},
"fnRowCallback": function( nRow, aData, iDisplayIndex , iDisplayIndexFull) {
//console.log(aData[0]);
selectall[page_no].push(aData[0]);
//console.log(page_no);
//console.log(selectall[page_no]);
$('#trip_infor_tbl tbody tr').each( function () {
if (jQuery.inArray(aData[0], aselected)!=-1) {
$(this).addClass('selected DTTT_selected ');
}
});
return nRow;
},
"fnDrawCallback": function ( oSettings ) {
if(oSettings._iRecordsTotal == 0) {
$("#trip_infor_tbl").find("td").remove();
$("#trip_infor_tbl tbody").append('<th class="odd"><td valign="top" colspan="8" class="dataTables_empty">No data available in table</td></th>');
}
if(oSettings._iDisplayLength != -1) {
page = Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength );
}
selected_id.push(new Array());
$('#addbtn').attr('disabled','disabled'); //hide add to approve button on load
if (oSettings._iRecordsDisplay == 0) {
$('#addbtn').attr('disabled','disabled');
}else{
}
.................................................
答案 0 :(得分:0)
尝试不使用“bProcessing”行:true或/和“bServerSide”:true 你的桌子不是很大,所以你不应该注意到任何性能损失