Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 29 additions & 54 deletions src/components/MyVuetable.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
<template>
<div class="ui container">
<filter-bar></filter-bar>
<vuetable ref="vuetable"
:api-url="apiUrl"
:fields="fields"
pagination-path=""
:per-page="10"
:multi-sort="true"
:sort-order="sortOrder"
:append-params="appendParams"
detail-row-component="detailRowComponent"
@vuetable:cell-clicked="onCellClicked"
@vuetable:pagination-data="onPaginationData"
>
<template :slot="slotName" scope="props" v-for="slotName in $scopedSlots?Object.keys($scopedSlots):null" >
<slot :name="slotName" :row-data="props.rowData" :row-index="props.rowIndex" :row-field="props.rowField"></slot>
</template>
</vuetable>
<div class="vuetable-pagination ui basic segment grid">
<vuetable-pagination-info ref="paginationInfo"
></vuetable-pagination-info>
<vuetable-pagination ref="pagination"
@vuetable-pagination:change-page="onChangePage"
></vuetable-pagination>
</div>
</div>
</template>
<script>
import accounting from 'accounting'
import moment from 'moment'
Expand Down Expand Up @@ -51,60 +79,7 @@ export default {
this.$events.$on('filter-set', eventData => this.onFilterSet(eventData))
this.$events.$on('filter-reset', e => this.onFilterReset())
},
render(h) {
return h(
'div',
{
class: { ui: true, container: true }
},
[
h('filter-bar'),
this.renderVuetable(h),
this.renderPagination(h)
]
)
},
methods: {
// render related functions
renderVuetable(h) {
return h(
'vuetable',
{
ref: 'vuetable',
props: {
apiUrl: this.apiUrl,
fields: this.fields,
paginationPath: "",
perPage: 10,
multiSort: true,
sortOrder: this.sortOrder,
appendParams: this.appendParams,
detailRowComponent: this.detailRowComponent,
},
on: {
'vuetable:cell-clicked': this.onCellClicked,
'vuetable:pagination-data': this.onPaginationData,
},
scopedSlots: this.$vnode.data.scopedSlots
}
)
},
renderPagination(h) {
return h(
'div',
{ class: {'vuetable-pagination': true, 'ui': true, 'basic': true, 'segment': true, 'grid': true} },
[
h('vuetable-pagination-info', { ref: 'paginationInfo' }),
h('vuetable-pagination', {
ref: 'pagination',
on: {
'vuetable-pagination:change-page': this.onChangePage
}
})
]
)
},
// ------------------
methods: {
allcap (value) {
return value.toUpperCase()
},
Expand Down