Skip to content

Commit

Permalink
feat(datatable): make default per page value properly computed, relat…
Browse files Browse the repository at this point in the history
…ed to epicmaxco#130
  • Loading branch information
smartapant committed Mar 28, 2018
1 parent a65b1e0 commit ca71dc6
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="d-flex flex-md-row flex-column justify-content-md-between align-items-center">
<filter-bar @filter="onFilterSet"></filter-bar>
<items-per-page :options="itemsPerPage"
:defaultPerPage="defaultPerPage"
:defaultPerPage="defaultPerPageComputed"
@items-per-page="onItemsPerPage"></items-per-page>
</div>
<vuetable ref="vuetable"
Expand Down Expand Up @@ -65,13 +65,7 @@
},
defaultPerPage: {
type: Number,
default: () => {
let defaultPerPage = DefaultPerPageDefinition.itemsPerPage[0].value
if (this.itemsPerPage) {
defaultPerPage = this.itemsPerPage[0].value
}
return defaultPerPage
}
default: DefaultPerPageDefinition.itemsPerPage[0].value
},
onEachSide: {
type: Number,
Expand Down Expand Up @@ -108,6 +102,15 @@
css: DataTableStyles
}
},
computed: {
defaultPerPageComputed () {
let defaultPerPage = DefaultPerPageDefinition.itemsPerPage[0].value
if (this.$options.propsData.itemsPerPage) {
defaultPerPage = this.$options.propsData.itemsPerPage[0].value
}
return defaultPerPage
}
},
methods: {
onFilterSet (filterText) {
if (this.apiMode) {
Expand Down

0 comments on commit ca71dc6

Please sign in to comment.