Skip to content

Commit

Permalink
Merge pull request #542 from bcgov/GRAD-2520
Browse files Browse the repository at this point in the history
Grad 2520
  • Loading branch information
suzalflueck authored Feb 22, 2024
2 parents 44fc52b + 57c3f38 commit d8e834b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions frontend/src/components/DisplayTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
</b-table>

<b-pagination
v-if="totalRows"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
Expand Down Expand Up @@ -245,7 +246,8 @@ export default {
],
onMounted() {
// Set the initial number of items
this.totalRows = this.items.length;
// this.totalRows = this.items.length;
// this.rows = this.items.length;
},
data() {
return {
Expand Down Expand Up @@ -302,11 +304,11 @@ export default {
editableFields() {
return this.fields.filter((field) => field.editable);
},
// totalRows: function () {
// if (this.items?.length) {
// return this.items.length;
// } else return this.totalRows;
// },
totalRows: function () {
if (this.items?.length && !this.filter) {
return this.items.length;
} else return this.totalRows;
},
sortOptions() {
return this.fields
.filter((f) => f.sortable)
Expand Down Expand Up @@ -344,8 +346,11 @@ export default {
},
onFiltered(filteredItems) {
// Trigger pagination to update the number of buttons/pages due to filtering
this.totalRows = filteredItems.length;
this.currentPage = 1;
if (this.filter) {
this.totalRows = filteredItems.length;
}
this.currentPage = 0;
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion grad-version
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"version": {
"dev": "1.14.1",
"test": "1.14.1",
"prod": "1.13.1"
"prod": "1.14.1"
}
}

0 comments on commit d8e834b

Please sign in to comment.