From 09aed3f8fa2877f2c9f0ae7a8491b3d7aecc7410 Mon Sep 17 00:00:00 2001 From: Pandryl Date: Fri, 30 May 2014 22:10:23 -0700 Subject: [PATCH] Disable Pagination Added the option to disable pagination if unwanted. --- jquery.watable.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/jquery.watable.js b/jquery.watable.js index 4278eb6..93f9e60 100755 --- a/jquery.watable.js +++ b/jquery.watable.js @@ -42,6 +42,7 @@ actions: '', //holds action links pageSize: 10, //current pagesize pageSizes: [10, 20, 30, 40, 50, 'All'], //available pagesizes + noPager: true, //set true to disable pagination hidePagerOnEmpty: false, //removes pager if no rows preFill: false, //prefill table with empty rows sorting: true, // enable column sorting @@ -565,25 +566,28 @@ var footToolbar = $('
').appendTo(footCell); var footDiv = $('
').appendTo(footToolbar); + + if (priv.options.noPager == false) { var footPagerUl = $('').appendTo(footDiv); - - $('
  • «
  • '.f(_currPage == 1 ? 'disabled' : '')) - .on('click', {pageIndex: _currPage - 1}, priv.pageChanged).appendTo(footPagerUl); - - for (var i = lowerPage; i <= upperPage; i++) { - var link; - if (i == _currPage) { - link = $('
  • {0}
  • '.f(i)); - } - else { - link = $('
  • {0}
  • '.f(i, i > _totalPages ? 'disabled' : '')); - link.on('click', {pageIndex: i}, priv.pageChanged); - } - link.appendTo(footPagerUl); + + $('
  • «
  • '.f(_currPage == 1 ? 'disabled' : '')) + .on('click', {pageIndex: _currPage - 1}, priv.pageChanged).appendTo(footPagerUl); + + for (var i = lowerPage; i <= upperPage; i++) { + var link; + if (i == _currPage) { + link = $('
  • {0}
  • '.f(i)); + } + else { + link = $('
  • {0}
  • '.f(i, i > _totalPages ? 'disabled' : '')); + link.on('click', {pageIndex: i}, priv.pageChanged); + } + link.appendTo(footPagerUl); + } + $('
  • »
  • '.f(_currPage == _totalPages ? 'disabled' : '')) + .on('click', {pageIndex: _currPage + 1}, priv.pageChanged).appendTo(footPagerUl); } - $('
  • »
  • '.f(_currPage == _totalPages ? 'disabled' : '')) - .on('click', {pageIndex: _currPage + 1}, priv.pageChanged).appendTo(footPagerUl); - + //create pagesize dropdown if (priv.options.pageSizes.length) { var div = $('
    ').appendTo(footToolbar); @@ -1409,4 +1413,4 @@ Date.now = Date.now || function() { return +new Date; }; console = window.console || { log:function(){}, warn:function(){} }; -})(jQuery); \ No newline at end of file +})(jQuery);