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: {