2
我必須做錯了什麼,但我的代碼是非常基本的,幾乎沒有偏離他們在網絡上的例子。Datatables不處理頁面更改
我使用服務器端分頁,什麼我遇到的是,在眼前的頁面加載它在數據從服務器上拉和渲染表就好了。但是,分頁或更改頁面上的記錄數量確實會導致AJAX調用,但無法真正處理。
如果我更改jquery.dataTables.js(v 1.8.2)的第3562行,問題就會消失。
if (false)//json.sEcho*1 < oSettings.iDraw)
有些情況下該行:
function _fnAjaxUpdateDraw (oSettings, json)
{
if (typeof json.sEcho != 'undefined')
{
/* Protect against old returns over-writing a new one. Possible when you get
* very fast interaction, and later queires are completed much faster
*/
if (false)//json.sEcho*1 < oSettings.iDraw)
只是爲了證明我的設置是如何直接的方式是:
<script type="text/javascript">
$(function(){
$('#recTable').dataTable({
"bProcessing":true,
"bServerSide": true,
"sAjaxSource": "/recordings/partPageCallRecordings/",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
{ "bSortable": false }
]
});
});
</script>
和HTML:
<table id='recTable' class='vmTable' >
<thead>
<tr class='vmHeader'>
<th><input id='selectAll' type='checkbox'></input></th>
<th class='sortHead'>Date</th>
<th class='sortHead'>File Name</th>
<th class='sortHead'>Type</th>
<th class='sortHead'>Playback</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
從我的經驗與服務器上的數據進行交互的正確方法是從請求參數得到它,然後不修改它,並把它右中不變的響應回落。 –
完美的謝謝。我不知道我是如何忽略這一事實的,即我的硬件代碼中有這部分內容。 – andyortlieb