Last active
October 20, 2020 05:19
-
-
Save christian-smith/d93b80516d707b7af0e9bf07faeda25e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<q-table | |
:data="data" | |
:pagination="pagination" | |
@request="paginationRequest" | |
:columns="columns" | |
> | |
<template v-slot:top-left="topLeft"> | |
<TablePagination :pagination="topLeft.pagination" @request="paginationRequest" /> | |
</template> | |
</q-table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import ListenersMixin from 'quasar/src/mixins/listeners.js' | |
import Bottom from 'quasar/src/components/table/table-bottom' | |
import Pagination from 'quasar/src/components/table/table-pagination' | |
export default Vue.extend({ | |
mixins: [ | |
Bottom, | |
ListenersMixin, | |
Pagination | |
], | |
data () { | |
return { | |
innerPagination: Object.assign( | |
{ | |
sortBy: null, | |
descending: false, | |
page: 1, | |
rowsPerPage: this.rowsPerPageOptions.length > 0 ? this.rowsPerPageOptions[0] : 5 | |
}, | |
this.pagination | |
) | |
} | |
}, | |
computed: { | |
computedRowsNumber () { | |
return this.pagination.rowsNumber | |
}, | |
isServerSide () { | |
return this.computedPagination.rowsNumber !== undefined | |
} | |
}, | |
methods: { | |
requestServerInteraction (prop = {}) { | |
this.$nextTick(() => { | |
this.$emit('request', { | |
pagination: prop.pagination || this.computedPagination | |
}) | |
}) | |
} | |
}, | |
render (h) { | |
const bottom = h('div', [ | |
this.__getBottomDiv(h) | |
]) | |
// removes horizontal line | |
bottom.children[0].data.staticClass = 'row items-center justify-end' | |
return bottom | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is great. Thanks for this. Btw I tweak the gist to accomodate those with filters:
https://gist.github.com/ajcastro/83af279e7d7540f82cae791d9bd430f9