Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<template>
<div class="row mt-4" v-if="paginatedPanel !== null && paginatedPanel.totalItems > 0">
<div class="col-md-8">
<b-pagination
v-model="paginatedPanel.currentPage"
:total-rows="paginatedPanel.totalItems"
:per-page="paginatedPanel.pageSize"
aria-controls="groups-list"
align="center"
v-on:change="setPage"
></b-pagination>
<p>Total items: {{paginatedPanel.totalItems}}</p>
</div>
<div class="col-md-4">
<b-row>
<b-col sm="5">
<label for="page-size">Page size:</label>
</b-col>
<b-col sm="6">
<b-form-select id="page-size" v-model="input.paginatorPageSize" :options="pageSizeOptions" v-on:change="changePageSize"></b-form-select>
</b-col>
</b-row>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'Paginator',
props: {
paginatedPanel: Object,
onUpdate: Function
},
computed: mapState({
input: state => state.input
}),
data: function() {
return {
pageSizeOptions: [
{ value: 5, text: "5" },
{ value: 20, text: "20" },
{ value: 50, text: "50" },
{ value: 100, text: "100" }
]
};
},
methods: {
setPage: function(page) {
this.input.paginatorPage = page;
this.onUpdate();
},
changePageSize: function(pageSize) {
this.input.paginatorPageSize = pageSize;
this.onUpdate();
}
}
}
</script>