Update input.js

Using the value of the input field was giving inconsistent results. It would flip between the page you are going to and the page your on. Changed it to use the calculated current page instead.
pull/96/head
Anderezekial 10 years ago
parent 18d5eb1937
commit b763e0f162

@ -73,7 +73,8 @@ $.fn.dataTableExt.oPagination.input = {
$(nPrevious).click( function() {
oSettings.oApi._fnPageChange( oSettings, "previous" );
fnCallbackDraw( oSettings );
if ($(nInput).val() == 1)
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage == 1)
{
$(nFirst).addClass('disabled');
$(nPrevious).addClass('disabled');
@ -88,7 +89,8 @@ $.fn.dataTableExt.oPagination.input = {
$(nNext).click( function() {
oSettings.oApi._fnPageChange( oSettings, "next" );
fnCallbackDraw( oSettings );
if ($(nInput).val() == (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength)))
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage == (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength)))
{
$(nNext).addClass('disabled');
$(nLast).addClass('disabled');

Loading…
Cancel
Save