summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-12-02 00:11:24 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-12-07 21:44:22 +0300
commit80299e63f4c338d9537b051c57c1f3e5efb7721c (patch)
tree703ef23cbb936a1afd55d0ae3aafdace29e525de /docs
parent808171488a1229edd6799eac6280f268479bc26f (diff)
downloadwebui-vue-80299e63f4c338d9537b051c57c1f3e5efb7721c.tar.xz
Add documentation for table pagination
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Ic40d7b4580417590b2d465fe359198c92354c242
Diffstat (limited to 'docs')
-rw-r--r--docs/guide/components/table/index.md97
-rw-r--r--docs/guide/components/table/table-pagination.pngbin0 -> 107052 bytes
2 files changed, 96 insertions, 1 deletions
diff --git a/docs/guide/components/table/index.md b/docs/guide/components/table/index.md
index 3d13a2b8..cd1ba202 100644
--- a/docs/guide/components/table/index.md
+++ b/docs/guide/components/table/index.md
@@ -506,4 +506,99 @@ export default {
</script>
```
-<!-- ## Pagination -->
+
+## Pagination
+
+To add table pagination:
+1. Import the BVPaginationMixin
+1. Add the `per-page` and `current-page` props to the `<table>` component.
+1. Add the below HTML snippet to the template. Make sure to update the `total-rows` prop.
+
+```vue{21}
+<b-row>
+ <b-col sm="6">
+ <b-form-group
+ class="table-pagination-select"
+ :label="$t('global.table.itemsPerPage')"
+ label-for="pagination-items-per-page"
+ >
+ <b-form-select
+ id="pagination-items-per-page"
+ v-model="perPage"
+ :options="itemsPerPageOptions"
+ />
+ </b-form-group>
+ </b-col>
+ <b-col sm="6">
+ <b-pagination
+ v-model="currentPage"
+ first-number
+ last-number
+ :per-page="perPage"
+ :total-rows="getTotalRowCount(items.length)"
+ aria-controls="table-event-logs"
+ />
+ </b-col>
+</b-row>
+```
+![Table pagination example](./table-pagination.png)
+
+```vue
+<template>
+ <b-container>
+ <b-table
+ hover
+ responsive="md"
+ :items="filteredItems"
+ :fields="fields"
+ :per-page="perPage"
+ :current-page="currentPage"
+ />
+ <b-row>
+ <b-col sm="6">
+ <b-form-group
+ class="table-pagination-select"
+ :label="$t('global.table.itemsPerPage')"
+ label-for="pagination-items-per-page"
+ >
+ <b-form-select
+ id="pagination-items-per-page"
+ v-model="perPage"
+ :options="itemsPerPageOptions"
+ />
+ </b-form-group>
+ </b-col>
+ <b-col sm="6">
+ <b-pagination
+ v-model="currentPage"
+ first-number
+ last-number
+ :per-page="perPage"
+ :total-rows="getTotalRowCount(items.length)"
+ aria-controls="table-event-logs"
+ />
+ </b-col>
+ </b-row>
+ </b-container>
+</template>
+<script>
+import BVPaginationMixin, {
+ currentPage,
+ perPage,
+ itemsPerPageOptions
+} from '@/components/Mixins/BVPaginationMixin';
+
+export default {
+ mixins: [ BVPaginationMixin ],
+ data() {
+ return {
+ items: [...],
+ fields: [..],
+ currentPage,
+ perPage,
+ itemsPerPageOptions
+ },
+ }
+}
+</script>
+``` \ No newline at end of file
diff --git a/docs/guide/components/table/table-pagination.png b/docs/guide/components/table/table-pagination.png
new file mode 100644
index 00000000..88134d8f
--- /dev/null
+++ b/docs/guide/components/table/table-pagination.png
Binary files differ