数据表1.10-不显示结果 [英] DataTables 1.10 - Not Showing Results
本文介绍了数据表1.10-不显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的设置.
Javascript/jQuery:
$('#list').dataTable({
paging: false,
serverSide: true,
ajax: {
url: "/search/",
data: function (d) {
return $.extend({}, d, {
lid: Label.selectedId
});
}
}
});
HTML
<table id="list" class="table table-striped" width="100%">
<thead>
<tr>
<th>Title</th>
<th>First Name</th>
<th>Last Name</th>
<th>URL</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JSON响应
{"data": [["Test", "", "", ""]], "recordsTotal": 1, "draw": 1, "recordsFiltered": 1}
它是通过以下方式手动调用的:
It is getting called manually by doing this:
$('#list').DataTable().ajax.reload();
但是表格没有改变.我已经使用DataTables 1.9做了很多次了-有什么想法吗?
But the table does not change. I've done this many times with DataTables 1.9 without a hitch -- any ideas?
更新
我发现如果我关闭serverSide
,它会起作用.
I discovered if I turn off serverSide
, it works.
推荐答案
我发现了问题.它与JSON响应中的draw
一起使用.一直是1.
I found the problem. It was with the draw
in the JSON response. It was always 1.
如果使用serverSide: true
,则表示它将发送draw
作为变量,并且必须将其返回.
If you use serverSide: true
, that means it is going to send draw
as a variable, and it must be returned.
更多信息在这里: http://datatables.net/manual/server-side
这篇关于数据表1.10-不显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文