api - fnPagingInfo.js plug-in didn't correctly handle -1 page length

pull/7/merge
Allan Jardine 12 years ago
parent 2505b9b6f1
commit 38fa052444

@ -18,13 +18,15 @@
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
{ {
return { return {
"iStart": oSettings._iDisplayStart, "iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(), "iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength, "iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(), "iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(), "iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), "iPage": oSettings._iDisplayLength === -1 ?
"iTotalPages": Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
}; "iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
};
}; };

@ -23,8 +23,10 @@ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
"iLength": oSettings._iDisplayLength, "iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(), "iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(), "iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), "iPage": oSettings._iDisplayLength === -1 ?
"iTotalPages": Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
}; };
}; };

Loading…
Cancel
Save