我在我的网站中使用了jQuery DataTable,显示了我们客户的所有产品列表,我目前正在使用jQuery DataTable插件进行分页,搜索和排序。它工作正常除了一个问题数据加载非常慢。它从sql数据库加载8000行并填充表。
这是我的代码
if($('#product-liste').length) {
jQuery('#product-list').dataTable({
"processing": true,
"serverSide": true,
"oLanguage": {
"sSearch": "Search",
"sProcessing": "Processing...",
"sLoadingRecords": "Processing...",
"sLengthMenu": "Show _MENU_ entries",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sEmptyTable": "No data available in table",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
}
},
"ajax": {
"url": window.location.href,
"type": "POST"
},
"columns": [
{ "data": "id" },
{ "data": "title" },
{ "data": "year" },
{ "data": "type" },
{ "data": "slug" }
],
"order": [[ 0, "desc" ]],
initComplete: function () {
}
});
}