diff --git a/app/frontend/src/components/forms/SubmissionsTable.vue b/app/frontend/src/components/forms/SubmissionsTable.vue index 719fd0db2..04ab4f128 100644 --- a/app/frontend/src/components/forms/SubmissionsTable.vue +++ b/app/frontend/src/components/forms/SubmissionsTable.vue @@ -344,7 +344,7 @@ export default { itemsPerPage: 10, page: 0, filterData: [], - sortBy: '', + sortBy: undefined, sortDesc: false, filterIgnore: [ { @@ -623,8 +623,8 @@ export default { }, async updateTableOptions({ page, itemsPerPage, sortBy, sortDesc }) { this.page = page - 1; - this.sortBy = sortBy; - this.sortDesc = sortDesc; + this.sortBy = sortBy[0] === 'date' ? 'createdAt' : sortBy[0]; + this.sortDesc = sortDesc[0]; this.itemsPerPage = itemsPerPage; await this.getSubmissionData(); }, diff --git a/app/frontend/src/components/forms/submission/MySubmissionsTable.vue b/app/frontend/src/components/forms/submission/MySubmissionsTable.vue index 043a66b73..7db262f62 100644 --- a/app/frontend/src/components/forms/submission/MySubmissionsTable.vue +++ b/app/frontend/src/components/forms/submission/MySubmissionsTable.vue @@ -158,7 +158,7 @@ export default { page: 0, filterData: [], preSelectedData: [], - sortBy: '', + sortBy: undefined, sortDesc: false, filterIgnore: [ { @@ -323,10 +323,9 @@ export default { }, async updateTableOptions({ page, itemsPerPage, sortBy, sortDesc }) { this.page = page - 1; - this.sortBy = sortBy; - this.sortDesc = sortDesc; + this.sortBy = sortBy[0] === 'date' ? 'createdAt' : sortBy[0]; + this.sortDesc = sortDesc[0]; this.itemsPerPage = itemsPerPage; - await this.populateSubmissionsTable(); }, async populateSubmissionsTable() { diff --git a/app/src/forms/common/models/views/submissionMetadata.js b/app/src/forms/common/models/views/submissionMetadata.js index cb36f179a..0385faf29 100644 --- a/app/src/forms/common/models/views/submissionMetadata.js +++ b/app/src/forms/common/models/views/submissionMetadata.js @@ -62,8 +62,8 @@ class SubmissionMetadata extends Model { if (!pagination) { builder.orderBy('createdAt', 'DESC'); } else { - let orderBy = params?.sortBy[0]; - let orderDesc = params?.sortDesc[0]; + let orderBy = params?.sortBy; + let orderDesc = params?.sortDesc; if (orderDesc === 'true') { builder.orderBy(orderBy, 'desc'); } else if (orderDesc === 'false') { diff --git a/app/src/forms/common/models/views/userSubmissions.js b/app/src/forms/common/models/views/userSubmissions.js index dfc8f82d2..b0239626c 100644 --- a/app/src/forms/common/models/views/userSubmissions.js +++ b/app/src/forms/common/models/views/userSubmissions.js @@ -64,8 +64,8 @@ class UserSubmissions extends Model { if (!pagination) { builder.orderBy('createdAt', 'DESC'); } else { - let orderBy = params?.sortBy[0]; - let orderDesc = params?.sortDesc[0]; + let orderBy = params?.sortBy; + let orderDesc = params?.sortDesc; if (orderDesc === 'true') { builder.orderBy(orderBy, 'desc'); } else if (orderDesc === 'false') {