From b5ed61e6c0a2e0d534635efc1cce30f102001431 Mon Sep 17 00:00:00 2001 From: Hector Romero Date: Sun, 23 Jul 2017 06:38:17 -0700 Subject: [PATCH] Hide the pagination if pageSize === 0 --- dist/amd/au-table-pagination.js | 6 +++++- dist/commonjs/au-table-pagination.js | 6 +++++- dist/es2015/au-table-pagination.js | 6 +++++- dist/system/au-table-pagination.js | 6 +++++- src/au-table-pagination.js | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/dist/amd/au-table-pagination.js b/dist/amd/au-table-pagination.js index 6c88976..b7b701f 100644 --- a/dist/amd/au-table-pagination.js +++ b/dist/amd/au-table-pagination.js @@ -112,7 +112,11 @@ define(['exports', 'aurelia-framework'], function (exports, _aureliaFramework) { }; AutPaginationCustomElement.prototype.calculatePages = function calculatePages() { - this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + if (this.pageSize === 0) { + this.totalPages = 1; + } else { + this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + } if (isNaN(this.paginationSize) || this.paginationSize <= 0) { this.displayAllPages(); diff --git a/dist/commonjs/au-table-pagination.js b/dist/commonjs/au-table-pagination.js index ec63ce3..1e7d73b 100644 --- a/dist/commonjs/au-table-pagination.js +++ b/dist/commonjs/au-table-pagination.js @@ -109,7 +109,11 @@ var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0 }; AutPaginationCustomElement.prototype.calculatePages = function calculatePages() { - this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + if (this.pageSize === 0) { + this.totalPages = 1; + } else { + this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + } if (isNaN(this.paginationSize) || this.paginationSize <= 0) { this.displayAllPages(); diff --git a/dist/es2015/au-table-pagination.js b/dist/es2015/au-table-pagination.js index f0ad0f6..17fcd75 100644 --- a/dist/es2015/au-table-pagination.js +++ b/dist/es2015/au-table-pagination.js @@ -98,7 +98,11 @@ export let AutPaginationCustomElement = (_dec = bindable({ defaultBindingMode: b } calculatePages() { - this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + if (this.pageSize === 0) { + this.totalPages = 1; + } else { + this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + } if (isNaN(this.paginationSize) || this.paginationSize <= 0) { this.displayAllPages(); diff --git a/dist/system/au-table-pagination.js b/dist/system/au-table-pagination.js index b57c179..6744b4e 100644 --- a/dist/system/au-table-pagination.js +++ b/dist/system/au-table-pagination.js @@ -115,7 +115,11 @@ System.register(['aurelia-framework'], function (_export, _context) { }; AutPaginationCustomElement.prototype.calculatePages = function calculatePages() { - this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + if (this.pageSize === 0) { + this.totalPages = 1; + } else { + this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + } if (isNaN(this.paginationSize) || this.paginationSize <= 0) { this.displayAllPages(); diff --git a/src/au-table-pagination.js b/src/au-table-pagination.js index 2493383..10242f2 100644 --- a/src/au-table-pagination.js +++ b/src/au-table-pagination.js @@ -43,7 +43,11 @@ export class AutPaginationCustomElement { } calculatePages() { - this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + if (this.pageSize === 0) { + this.totalPages = 1 + }else { + this.totalPages = this.totalItems <= this.pageSize ? 1 : Math.ceil(this.totalItems / this.pageSize); + } if (isNaN(this.paginationSize) || this.paginationSize <= 0) { this.displayAllPages();