From e9d2d47175ccfc7f74f437a05233b93f401196f4 Mon Sep 17 00:00:00 2001 From: lefteris Date: Fri, 9 Apr 2021 19:38:45 +0300 Subject: [PATCH] pagination ok --- src/components/doclive/AdhocView.vue | 72 ++++++++++++++++++++++------ src/components/doclive/runLlo.vue | 2 +- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/components/doclive/AdhocView.vue b/src/components/doclive/AdhocView.vue index c2bae66..6281e04 100644 --- a/src/components/doclive/AdhocView.vue +++ b/src/components/doclive/AdhocView.vue @@ -95,26 +95,30 @@ :sort-order="sortOrder" :show-sort-icons="true" :multi-sort="multiSort" - data-path="" - pagination-path="" :per-page="perpage" + pagination-path="links.pagination" + detail-row-id="id" wrapper-class="vuetable-wrapper" loading-class="loading" + @vuetable:pagination-data="onPaginationData" + @vuetable:load-success="loadsuccess" + @vuetable:load-error="onLoadError" :css="css.table" > - + +
+ + + +
@@ -125,7 +129,9 @@ import { mapState, mapGetters, mapActions, dispatch } from "vuex"; import Vue from "vue"; import store from "@/store/index"; -import Vuetable from "vuetable-2"; +import { Vuetable, VuetablePaginationDropdown } from "vuetable-2"; +import VuetablePaginationInfo from "vuetable-2/src/components/VuetablePaginationInfo"; +import VuetablePagination from "vuetable-2/src/components/VuetablePagination"; import CssConfig from "vuetable-2/src/components/VuetableCssConfig.js"; import { codemirror } from "vue-codemirror"; @@ -170,6 +176,9 @@ export default { components: { codemirror, Vuetable, + VuetablePagination, + VuetablePaginationInfo, + VuetablePaginationDropdown, }, data() { return { @@ -383,6 +392,38 @@ export default { this.history = false; } }, + onPaginationData(paginationData) { + this.$refs.pagination.setPaginationData(paginationData); + this.$refs.paginationInfo.setPaginationData(paginationData); + }, + loadsuccess(response) { + var data = response.data.data; + this.fielddata = data; + //console.log(this.fielddata); + var n = data.length; + n = n - 1; + }, + onChangePage(page) { + this.$refs.vuetable.changePage(page); + }, + onLoadError(payload) { + /* + //error2 "invalid_token" join-service.vue:684 + //error2 "The access token provided has expired" join-service.vue:685 + //error2 "Unauthorized" join-service.vue:686 + //error2 401 + console.log('error2 '+JSON.stringify(payload.response.data.error)) + console.log('error2 '+JSON.stringify(payload.response.data.error_description)) + console.log('error2 '+JSON.stringify(payload.response.statusText)) + console.log('error2 '+JSON.stringify(payload.response.status)) + */ + if (payload.response.status == "401") { + window.location.href = "https://api-login.swarmlab.io:8089"; + Vue.nextTick( + () => (window.location.href = "https://api-login.swarmlab.io:8089") + ); + } + }, clear() { this.tryConsole = false; this.code = ""; @@ -606,6 +647,7 @@ export default {