Skip to content

Commit

Permalink
#342 all per page info fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xaksis committed Jul 25, 2018
1 parent e0e669e commit 52e5858
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/VgtPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/VgtPaginationPageInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 52e5858

Please sign in to comment.