我有一个具有排序、搜索和页行限制功能的JQuery数据表。搜索运行得很好。
但是排序和页面行数限制功能是不工作的,首先加载页面。如果我搜索一些东西,并尝试页面行限制功能和排序,那么工作正常。
我的脚本代码:
<script>
$(document).ready(function() {
$('#dataTables-example').dataTable({
"serverside": true,
"searching": true,
"ordering": true,
"deferLoading": 57,
"displayStart": 20,
"order":[2, "asc"]
});
});
</script>
(此脚本位于表格html代码之后。)
我找不出这里的错误。请帮帮我。
发布于 2017-03-13 09:28:54
你不应该用"dataTable“而不是"DataTable”吗?
$(document).ready(function() {
$('#dataTables-example').DataTable();
});
dataTable() vs. DataTable() - why is there a difference and how do I make them work together?
https://datatables.net/forums/discussion/23540/datatable-vs-datatable
还有一个使用DataTable的order函数的示例:https://datatables.net/examples/basic_init/table_sorting.html
https://stackoverflow.com/questions/42759878
复制相似问题