如何配置Jquery DataTable以在第一次加载时不加载所有内容
例如,如果我有 1000 记录,DataTable将在第一次加载时加载,但这可能很重。点击分页部分时如何加载每个内容?像This
一样$(document).ready( function () {
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "xhr.php"
} );
} );
有相同分页的ServerSide配置请告诉我,如果我的问题是重复只是喊出来。
答案 0 :(得分:0)
使用“deferLoading”属性:
https://datatables.net/examples/server_side/defer_loading.html
答案 1 :(得分:0)
点击这里查看完整的jquery示例 jquery-datatable-ajax-tutorial-with-example
var studentTable;
jQuery(document).ready(function() {
studentTable = jQuery("#studentListTable").dataTable({
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bRetrieve" : true,
"bFilter" : true,
"iDisplayLength": 10,
"bProcessing" : true,
"bServerSide" : false,
"aoColumns" : [ { "bSearchable" : false,"bVisible" : false,
"asSorting" : [ "asc" ] },
{"sWidth" : "20%","bSortable" : true },
{"sWidth" : "20%","bSortable" : true },
{"sWidth" : "20%","bSortable" : true },
{"sWidth" : "20%","bSortable" : true },
{"sWidth" : "20%","bSortable" : true }
]
});
jQuery(".ui-corner-br").addClass("ui-widget-header_custom");
});