0
以下是HTML代碼:數據表顯示錯誤的頁面數
<table id="myTable" class="dTable1 contentList table table-bordered" style="z-index: 2; ">
<thead id="tableHeader">
<tr id="headerRow">
<th>Time</th>
<th>Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
我初始化表上彈出打開使用下面的JavaScript代碼:
showHistory = function (contentID) {
debugger;
var auditRes;
//var oTable = $('#AuditListtable').dataTable();
//oTable.fnDestroy();
//alert("outside");
$('#AuditListtable').dataTable({
"sAjaxSource":SERVERURL?contentId=' + contentID,
"aoColumns": [
{ "mData": "AccessDate" },
{
"mData": "EventDescription",
"bSortable": false
},
{
"mData": "IPAddress",
"bSortable": false,
"mRender": function (data, type, row) {
debugger;
return '<td> <span title="' + data + '">Played By: ' + row.FirstName + ', IP Address: ' + data + '</span></td>';
}
}
],
"paging": true,
"sDom": '<"top"p<"clear">>rt',
"sPaginationType": "full_numbers",
"searching": false,
"bFilter": false,
"processing": true,
"bServerSide": true,
"order":true,
"sServerMethod": "POST",
"bAutoWidth": false,
"iDisplayLength": 8
});
$('#historyPopup').modal('show');
}
的數據將在彈出來填充。目前我們共有9條記錄,但分頁顯示爲5頁。點擊另一頁後,它會顯示上一條記錄。表格不刷新。
您已啓用服務器端處理,使用「bServerSide」:true'。很有可能您的回覆不正確。如果您確實需要進行服務器端處理,則您的響應應包含如下內容:「iTotalRecords」:「9」,「iTotalDisplayRecords」:「9」。請從服務器發佈您的JSON響應。 –
@ Gyrocode.com問題出現在響應中。響應發送iTotalRecords而不是iTotalDisplayRecords。另外,sEcho的價值是硬編碼的。你能否把你的建議作爲答案? –