Cosmetics

pull/12/head
cagataycivici 2019-03-21 10:16:44 +03:00
parent 920c50aec1
commit e331c9fc4c
2 changed files with 12 additions and 8 deletions

View File

@ -45,7 +45,10 @@ export default {
type: Number,
default: 5
},
rowsPerPageOptions: Array,
rowsPerPageOptions: {
type: Array,
default: null
},
template: {
type: String,
default: 'FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown'
@ -66,7 +69,7 @@ export default {
},
computed: {
templateItems() {
var keys = [];
let keys = [];
this.template.split(' ').map((value) => {
keys.push(value.trim());
})
@ -120,17 +123,18 @@ export default {
},
methods: {
changePage(first, rows) {
var pc = this.pageCount;
var p = Math.floor(first / rows);
const pc = this.pageCount;
const p = Math.floor(first / rows);
if (p >= 0 && p < pc) {
var newPageState = {
let newPageState = {
first: first,
rows: rows,
page: p,
pageCount: pc
};
this.$emit('change', newPageState);
this.$emit('page-change', newPageState);
this.$emit('update:first', first);
this.$emit('update:rows', rows);
}

View File

@ -12,7 +12,7 @@
<Paginator :first.sync="first" :rows.sync="rows" :totalRecords="totalRecords" :rowsPerPageOptions="[10,20,30]"></Paginator>
<h3>Custom Template</h3>
<Paginator :first="first2" :rows="rows2" :totalRecords="totalRecords2" @change="onPageChangeCustom($event)" template="FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink">
<Paginator :first="first2" :rows="rows2" :totalRecords="totalRecords2" @page-change="onPageChangeCustom($event)" template="FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink">
<template #left>
<Button type="button" icon="pi pi-refresh" />
</template>