Skip to content

Commit

Permalink
Fixes changing of pagesize on custom tables when pagination isn't hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
mightycox committed Sep 14, 2024
1 parent f02f8cd commit 573e3a6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
17 changes: 14 additions & 3 deletions frontend/src/components/common/CustomTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
v-model:page.sync="pageNumber"
v-model:items-per-page.sync="pageSize"
v-model="selected"
:class="itemsPerPageOptions.length === 0 ? 'hide-items-per-page' : ''"
:items-length="totalElements"
:items="data"
:headers="headers"
mobile-breakpoint="0"
:items-per-page-options="itemsPerPageOptions"
>
<template #top>
<v-progress-linear
Expand Down Expand Up @@ -280,6 +282,10 @@ export default {
clickable: {
type: Boolean,
default: true
},
itemsPerPageOptions: {
type: Array,
default: () => []
}
},
emits: ['reload', 'openStudentDetails', 'selections', 'editSelectedRow'],
Expand All @@ -299,6 +305,11 @@ export default {
...mapState(appStore, ['config']),
},
watch: {
pageSize(newPageSize) {
this.masterCheckbox = false;
this.selected = [];
this.$emit('reload', {pageNumber: 0, pageSize: newPageSize});
},
pageNumber: {
handler(val) {
if(val) {
Expand Down Expand Up @@ -420,9 +431,9 @@ export default {
vertical-align: top !important;
}
:deep(.v-data-table-footer__items-per-page) {
display: none;
}
:deep(.hide-items-per-page .v-data-table-footer__items-per-page) {
display: none;
}
.hoverTable tr:hover td {
background-color: #e8e8e8 !important;
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/data-collection/PenReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
:data="studentList"
:total-elements="totalElements"
:is-loading="isLoading"
:items-per-page-options="[
{value: 15, title: '15'},
{value: 25, title: '25'},
{value: 50, title: '50'}
]"
@reload="reload"
@selections="selectedStudents = $event"
@editSelectedRow="editStudent"
Expand Down Expand Up @@ -137,9 +142,5 @@ export default {
.table {
width: none !important;
}
:deep(.v-data-table-footer__items-per-page) {
display: flex;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export default {
.then(response => {
this.sldData = response?.data?.content;
this.sldData.map(data => {
console.log(data);
if(this.existingMergedStudentIds.includes(data.assignedStudentId)) {
data.toolTipText = `Merged from ${data.assignedPen}`;
data.toolTipChipText = 'M';
Expand Down

0 comments on commit 573e3a6

Please sign in to comment.