3
我正在與DataTables一起工作,我需要知道當前表的頁數(這當然取決於每頁的行數和總行數,並且可能會按用戶操作更改)。有人知道如何訪問這個值嗎?如何獲取DataTable中的頁數
我正在與DataTables一起工作,我需要知道當前表的頁數(這當然取決於每頁的行數和總行數,並且可能會按用戶操作更改)。有人知道如何訪問這個值嗎?如何獲取DataTable中的頁數
我相信iTotalPages就是你追求:http://datatables.net/plug-ins/api#fnPagingInfo
$.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings){
return {
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil(oSettings.fnRecordsDisplay()/oSettings._iDisplayLength)
};
};
$('#example').dataTable({
"fnDrawCallback": function(){
alert('There are ' + this.fnPagingInfo().iTotalPages + ' in this table.');
}
});
非常感謝。這正是我需要的。 – Mannimalte