Dont overwrite currentSize of mdTablePagination (#692)

* Dont overwrite currentSize of mdTablePagination with
the first value from mdPageOptions.

Check the value currentSize if it is in the array of options and set it, otherwise just take the (default) first option.

* map props default value to local data property

* allow passing the prop as a string value

by parsing it as an int
This commit is contained in:
Paul Schmidt 2017-05-08 00:39:38 +02:00 committed by Marcos Moura
parent 8042caef99
commit ed4c9c5cba

View file

@ -49,7 +49,7 @@
subTotal: 0,
totalItems: 0,
currentPage: 1,
currentSize: 0
currentSize: parseInt(this.mdSize, 10)
};
},
watch: {
@ -108,7 +108,7 @@
this.$nextTick(() => {
this.subTotal = this.currentPage * this.currentSize;
this.mdPageOptions = this.mdPageOptions || [10, 25, 50, 100];
this.currentSize = this.mdPageOptions[0];
this.currentSize = this.mdPageOptions.includes(this.currentSize) ? this.currentSize : this.mdPageOptions[0];
this.canFireEvents = true;
});
}