Skip to content

Commit

Permalink
fix: views respect sorting
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Mar 8, 2024
1 parent aeda9cd commit 89ca0f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/modules/main/sections/MainWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export default {
this.localLoading = true
this.viewSetting = {}
if (this.isView && this.element?.sort?.length) {
this.viewSetting.sorting = [...this.element.sort]
}
await this.$store.dispatch('loadColumnsFromBE', {
view: this.isView ? this.element : null,
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/ncTable/sections/CustomTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export default {
getSearchedAndFilteredAndSortedRows() {
// if we have to sort
if (this.viewSetting?.sorting) {
const sortColumn = this.columns.find(item => item.id === this.viewSetting.sorting[0].columnId)
return [...this.getSearchedAndFilteredRows].sort(sortColumn.sort(this.viewSetting.sorting[0].mode))
const sortColumn = this.columns.find(item => item.id === this.viewSetting.sorting?.[0].columnId)
return [...this.getSearchedAndFilteredRows].sort(sortColumn?.sort?.(this.viewSetting.sorting[0].mode))
}
return this.getSearchedAndFilteredRows
},
Expand Down

0 comments on commit 89ca0f6

Please sign in to comment.