From 1ebab248e7c846d71cad3a848b532e86b39486bf Mon Sep 17 00:00:00 2001 From: enkodellc Date: Sat, 11 Jul 2015 00:37:15 -0700 Subject: [PATCH 1/2] Add logic to show only page size if the row count is greater than the count and less than the next button --- src/ng-table/pager.html | 2 ++ src/scripts/03-params.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/ng-table/pager.html b/src/ng-table/pager.html index abe09808..7b11c7c4 100644 --- a/src/ng-table/pager.html +++ b/src/ng-table/pager.html @@ -1,6 +1,7 @@
+git diff --git a/src/scripts/03-params.js b/src/scripts/03-params.js index a30744bf..beb429e2 100644 --- a/src/scripts/03-params.js +++ b/src/scripts/03-params.js @@ -38,6 +38,28 @@ app.factory('NgTableParams', ['$q', '$log', 'ngTableDefaults', function($q, $log this.data = []; + /** + * @maxCount method + * @name NgTableParams#parameters + * @description Determines if a page size button should be visible based on # of rows in table + * + * @param {count} the current count of the page size button + * @returns {boolean} false if the button should be hidden, true if it should be visible + */ + this.maxCount = function(count){ + var total = this.total(); + if (total > 0 && count <= total) { + return true; + } + if (total > this.settings().counts[this.settings().counts.length-1]) { + return true; + } + if (total < count && total > this.settings().counts[this.settings().counts.indexOf(count)-1]) { + return true; + } + return false; + }; + /** * @ngdoc method * @name NgTableParams#parameters From c77daaa464a31e76f1ef2f39315f5e2bc4d19209 Mon Sep 17 00:00:00 2001 From: enkodellc Date: Sat, 11 Jul 2015 00:46:59 -0700 Subject: [PATCH 2/2] Add logic to show only page size if the row count is greater than the count and less than the next button --- src/ng-table/pager.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng-table/pager.html b/src/ng-table/pager.html index 7b11c7c4..1cfdec15 100644 --- a/src/ng-table/pager.html +++ b/src/ng-table/pager.html @@ -18,4 +18,4 @@
-git +