From b763e0f1625829ad2d73a47f846a6ec6367a67c9 Mon Sep 17 00:00:00 2001 From: Anderezekial Date: Tue, 2 Sep 2014 15:22:52 -0700 Subject: [PATCH] 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. --- pagination/input.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pagination/input.js b/pagination/input.js index 57c44da..2085009 100644 --- a/pagination/input.js +++ b/pagination/input.js @@ -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');