diff --git a/src/components/feature/FeatureListTable.vue b/src/components/feature/FeatureListTable.vue index 6e10b5d9adf0f96978ac202bfa1090a56f069f7d..c2713a9fdd336c14fecf44da7992562fa64d1e5f 100644 --- a/src/components/feature/FeatureListTable.vue +++ b/src/components/feature/FeatureListTable.vue @@ -162,16 +162,16 @@ > <span> <a - v-for="(page, index) in nbPages" - :key="'page' + index" + v-for="pageNumber in nbPages" + :key="'page' + pageNumber" :class="[ 'paginate_button', - { current: page.value === pagination.currentPage }, + { current: pageNumber === pagination.currentPage }, ]" aria-controls="table-features" data-dt-idx="1" tabindex="0" - >{{ page.value }}</a + >{{ pageNumber }}</a > </span> <!-- // TODO : <span v-if="nbPages > 4" class="ellipsis">...</span> --> @@ -200,7 +200,7 @@ export default { currentPage: 1, pagesize: 15, start: 0, - end: 14, + end: 15, }, sort: { column: "", @@ -254,10 +254,28 @@ export default { return filterdFeatures.slice(this.pagination.start, this.pagination.end); }, + nbPages() { + let N = Math.round( + this.filteredFeatures.length / this.pagination.pagesize + ); + console.log("N", N); + let rest = Math.round( + this.filteredFeatures.length % this.pagination.pagesize + ); + console.log("rest", rest); + if (rest > 0) N++; + const arr = [...Array(N).keys()].map(function (x) { + ++x; + return x; + }); + console.log("arr", arr); + return arr; + }, + displayedPageEnd() { - return this.pagination.end < 15 + return this.filteredFeatures.length <= this.pagination.end ? this.filteredFeatures.length - : this.pagination.end + 1; + : this.pagination.end; }, }, @@ -283,24 +301,6 @@ export default { } }, - nbPages() { - let N = Math.round( - this.filteredFeatures.length / this.pagination.pagesize - ); - let rest = Math.round( - this.filteredFeatures.length % this.pagination.pagesize - ); - if (rest > 0) N++; - const arr = [...Array(N).keys()].map(function (x) { - ++x; - return { - index: x, - value: x, - }; - }); - return arr; - }, - toPreviousPage() { if (this.pagination.start > 0) { this.pagination.start -= this.pagination.pagesize;