diff --git a/app/ayanova/src/components/widgetlist.vue b/app/ayanova/src/components/widgetlist.vue index c9ad7372..3105dc21 100644 --- a/app/ayanova/src/components/widgetlist.vue +++ b/app/ayanova/src/components/widgetlist.vue @@ -58,28 +58,12 @@ export default { totalItems: 0 } */ - // this.getDataFromApi().then(data => { - // this.Items = data.items; - // this.totalItems = data.total; - // }); }, deep: true } }, mounted() { this.getDataFromApi(); - // this.loading = true; - // pagedList.fetch("Widget/ListWidgets", { Offset: 5, Limit: 5 }).then(res => { - // // debugger; - // this.loading = false; - // this.Items = res.data; - // this.totalItems = res.paging.count; - // }); - - // this.getDataFromApi().then(data => { - // this.Items = data.items; - // this.totalItems = data.total; - // }); }, methods: { getDataFromApi() { @@ -88,18 +72,12 @@ export default { Limit: 5 }; - if (this.pagination.rowsPerPage) { + if (this.pagination.rowsPerPage && this.pagination.rowsPerPage > 0) { + listOptions.Offset = + (this.pagination.page - 1) * this.pagination.rowsPerPage; listOptions.Limit = this.pagination.rowsPerPage; } - if (this.pagination.page) { - if (this.pagination.page > 0) { - listOptions.Offset = this.pagination.page * listOptions.Limit; - } else { - listOptions.Offset = 0; - } - } - this.loading = true; pagedList.fetch("Widget/ListWidgets", listOptions).then(res => { // debugger; @@ -108,41 +86,6 @@ export default { this.totalItems = res.paging.count; }); } - // getDataFromApi() { - // //http://localhost:7575/api/v8.0/Widget/ListWidgets?Offset=5&Limit=5 - // this.loading = true; - // // eslint-disable-next-line - // return new Promise((resolve, reject) => { - // const { sortBy, descending, page, rowsPerPage } = this.pagination; - // let items = this.getItems(); - // const total = items.length; - // if (this.pagination.sortBy) { - // items = items.sort((a, b) => { - // const sortA = a[sortBy]; - // const sortB = b[sortBy]; - // if (descending) { - // if (sortA < sortB) return 1; - // if (sortA > sortB) return -1; - // return 0; - // } else { - // if (sortA < sortB) return -1; - // if (sortA > sortB) return 1; - // return 0; - // } - // }); - // } - // if (rowsPerPage > 0) { - // items = items.slice((page - 1) * rowsPerPage, page * rowsPerPage); - // } - // setTimeout(() => { - // this.loading = false; - // resolve({ - // items, - // total - // }); - // }, 1000); - // }); - // } } };