mdTablePagination emits pagination and page events, but there's no way to know if we should move to the next page or the previous page (unless I'm missing something?).
Here's the code responsible for that:
https://github.com/marcosmoura/vue-material/blob/master/src/components/mdTable/mdTablePagination.vue#L73
The same method is called regardless of if it's the next or the previous button that has been pressed.
This could be fixed by passing an argument to that method here and here.
I can create a pull request to implement this if that's okay?
I'm exactly in the same situation.
I will focus on improvements over pagination. I will fix this for the very next version. Sorry about that. Thanks!
Awesome, thanks!
I've tested some modification locally and this was enough:
previousPage() {
if (this.canFireEvents) {
this.currentPage--;
this.$emit('page', this.currentPage);
this.emitPaginationEvent();
}
},
nextPage() {
if (this.canFireEvents) {
this.currentPage++;
this.$emit('page', this.currentPage);
this.emitPaginationEvent();
}
}
There's more:
<span>{{ ((currentPage - 1) * currentSize) + 1 }}-{{ currentSize * currentPage }} {{ mdSeparator }} {{ mdTotal }}</span>
@jonataswalker Great! Can you create this as a PR? :D
@jonataswalker Just watch when incrementing / decrementing currentPage, so it doesn't go below 0 or above total number of items :)
@petarjs Yes, for sure, I'll handle it.
@marcosmoura The PR is on the way.