Skip to content

Commit ee17f32

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
* origin/master: refactor property names to make more sense vuematerial#517 (vuematerial#521) fix pagination not enabling next button when total changes vuematerial#482. (vuematerial#517)
2 parents d66bc0a + b380dcf commit ee17f32

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/components/mdTable/mdTablePagination.vue

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<md-icon>keyboard_arrow_left</md-icon>
1313
</md-button>
1414

15-
<md-button class="md-icon-button md-table-pagination-next" @click.native="nextPage" :disabled="currentSize * currentPage >= totalItems">
15+
<md-button class="md-icon-button md-table-pagination-next" @click.native="nextPage" :disabled="shouldDisable">
1616
<md-icon>keyboard_arrow_right</md-icon>
1717
</md-button>
1818
</div>
@@ -47,14 +47,28 @@
4747
data() {
4848
return {
4949
subTotal: 0,
50-
currentSize: parseInt(this.mdSize, 10),
51-
currentPage: parseInt(this.mdPage, 10),
52-
totalItems: isNaN(this.mdTotal) ? Number.MAX_SAFE_INTEGER : parseInt(this.mdTotal, 10)
50+
totalItems: 0,
51+
currentPage: 1,
52+
currentSize: 0
5353
};
5454
},
55+
watch: {
56+
mdTotal(val) {
57+
this.totalItems = isNaN(val) ? Number.MAX_SAFE_INTEGER : parseInt(val, 10);
58+
},
59+
mdSize(val) {
60+
this.currentSize = parseInt(val, 10);
61+
},
62+
mdPage(val) {
63+
this.currentPage = parseInt(val, 10);
64+
}
65+
},
5566
computed: {
5667
lastPage() {
5768
return false;
69+
},
70+
shouldDisable() {
71+
return this.currentSize * this.currentPage >= this.totalItems;
5872
}
5973
},
6074
methods: {

0 commit comments

Comments
 (0)