From 52e5858e96497209e4ee98683887329e2f1c974e Mon Sep 17 00:00:00 2001 From: Akshay Anand Date: Wed, 25 Jul 2018 09:42:28 -0400 Subject: [PATCH] #342 all per page info fixed --- src/components/VgtPagination.vue | 4 ++++ src/components/VgtPaginationPageInfo.vue | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/VgtPagination.vue b/src/components/VgtPagination.vue index 46f79ca2..9ca32da1 100644 --- a/src/components/VgtPagination.vue +++ b/src/components/VgtPagination.vue @@ -162,6 +162,10 @@ export default { if (event) { this.currentPerPage = parseInt(event.target.value, 10); } + if (this.currentPerPage === -1) { + // reset current page to 1 + this.currentPage = 1; + } this.$emit('per-page-changed', { currentPerPage: this.currentPerPage }); }, diff --git a/src/components/VgtPaginationPageInfo.vue b/src/components/VgtPaginationPageInfo.vue index fede20d3..b2966cfc 100644 --- a/src/components/VgtPaginationPageInfo.vue +++ b/src/components/VgtPaginationPageInfo.vue @@ -39,7 +39,7 @@ export default { return `${this.ofText} ${this.lastPage}`; }, lastPage() { - return Math.ceil(this.totalRecords / this.currentPerPage); + return this.currentPerPage === -1 ? 1 : Math.ceil(this.totalRecords / this.currentPerPage); }, }, methods: {