DataTables 分页似乎不适用于服务器端数据
DataTables pagination doesn't seem to work with server side data
我不明白为什么这个分页不起作用:
jQuery(function($) {
$('#lista-contatti').DataTable({
"processing": true,
"serverSide": true,
//"info": true,
"ajax": {
url: "/test/ajax_datatable.cfm",
cache: false,
},
"columns": [
{ "data": "id" },
{ "data": "ute_nominativo" },
{ "data": "ute_email" },
{ "data": "ute_data" },
{ "data": "ute_ip" },
{ "data": "ute_lista"},
{ "data": "azioni" }
]
});
});
它只在第一页工作,但不加载下一页。我仍然缺少一些东西......
您的服务器端脚本应该 return draw
参数与请求中的 draw
参数具有相同的值。现在你总是 returning 1
.
来自manual:
draw
The draw counter that this object is a response to - from the draw
parameter sent as part of the data request. Note that it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply echoing back to the client what it sent in the draw
parameter, in order to prevent Cross Site Scripting (XSS) attacks.
我不明白为什么这个分页不起作用:
jQuery(function($) {
$('#lista-contatti').DataTable({
"processing": true,
"serverSide": true,
//"info": true,
"ajax": {
url: "/test/ajax_datatable.cfm",
cache: false,
},
"columns": [
{ "data": "id" },
{ "data": "ute_nominativo" },
{ "data": "ute_email" },
{ "data": "ute_data" },
{ "data": "ute_ip" },
{ "data": "ute_lista"},
{ "data": "azioni" }
]
});
});
它只在第一页工作,但不加载下一页。我仍然缺少一些东西......
您的服务器端脚本应该 return draw
参数与请求中的 draw
参数具有相同的值。现在你总是 returning 1
.
来自manual:
draw
The draw counter that this object is a response to - from the
draw
parameter sent as part of the data request. Note that it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply echoing back to the client what it sent in thedraw
parameter, in order to prevent Cross Site Scripting (XSS) attacks.