Vue-material: mdTablePagination - No way to know if next page or prev page?

Created on 6 Dec 2016  路  8Comments  路  Source: vuematerial/vue-material

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?

bug

All 8 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maryleloisa picture maryleloisa  路  3Comments

Leshgan picture Leshgan  路  3Comments

lovepluskaka picture lovepluskaka  路  3Comments

philipfeldmann picture philipfeldmann  路  3Comments

diverted247 picture diverted247  路  3Comments