diff --git a/beta-testing/example-pager-custom-controls.html b/beta-testing/example-pager-custom-controls.html index 082f694b..c044b3f3 100644 --- a/beta-testing/example-pager-custom-controls.html +++ b/beta-testing/example-pager-custom-controls.html @@ -97,6 +97,7 @@

NOTE!

diff --git a/beta-testing/pager-custom-controls.js b/beta-testing/pager-custom-controls.js index 4e2c1434..194bc0d2 100644 --- a/beta-testing/pager-custom-controls.js +++ b/beta-testing/pager-custom-controls.js @@ -36,18 +36,21 @@ $.tablesorter.customPagerControls = function(settings) { $table .on('pagerInitialized pagerComplete', function (e, c) { - var indx, pages = $('
'), pageArray = [], - cur = c.page + 1, - start = cur > 1 ? (c.filteredPages - cur < options.aroundCurrent ? -(options.aroundCurrent + 1) + (c.filteredPages - cur) : -options.aroundCurrent) : 0, - end = cur < options.aroundCurrent + 1 ? options.aroundCurrent + 3 - cur : options.aroundCurrent + 1; + var indx, + p = c.pager ? c.pager : c, // using widget + pages = $('
'), + pageArray = [], + cur = p.page + 1, + start = cur > 1 ? (p.filteredPages - cur < options.aroundCurrent ? -(options.aroundCurrent + 1) + (p.filteredPages - cur) : -options.aroundCurrent) : 0, + end = cur < options.aroundCurrent + 1 ? options.aroundCurrent + 3 - cur : options.aroundCurrent + 1; for (indx = start; indx < end; indx++) { - if (cur + indx >= 1 && cur + indx < c.filteredPages) { pageArray.push( cur + indx ); } + if (cur + indx >= 1 && cur + indx < p.filteredPages) { pageArray.push( cur + indx ); } } if (pageArray.length) { // include first and last pages (ends) in the pagination for (indx = 0; indx < options.ends; indx++){ if ($.inArray(indx + 1, pageArray) === -1) { pageArray.push(indx + 1); } - if ($.inArray(c.filteredPages - indx, pageArray) === -1) { pageArray.push(c.filteredPages - indx); } + if ($.inArray(p.filteredPages - indx, pageArray) === -1) { pageArray.push(p.filteredPages - indx); } } // sort the list pageArray = pageArray.sort(function(a, b){ return a - b; }); diff --git a/docs/index.html b/docs/index.html index 1fb5fe0d..d25ed70b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -532,7 +532,7 @@

Work-in-progress