Browse Source

fix: update handleGetSortsData for single level of user sort

pull/7276/head
Ramesh Mane 11 months ago
parent
commit
a87b8c9bd3
  1. 10
      packages/nc-gui/composables/useUserSorts.ts

10
packages/nc-gui/composables/useUserSorts.ts

@ -61,16 +61,18 @@ export function useUserSorts() {
if (fieldIndex !== -1) { if (fieldIndex !== -1) {
// Update the direction if the field exists // Update the direction if the field exists
sorts.value = [ sorts.value = [
...clone(sorts.value).map((sort) => { ...clone(sorts.value)
.map((sort) => {
if (sort.field === newSortConfig.field) { if (sort.field === newSortConfig.field) {
sort.direction = newSortConfig.direction sort.direction = newSortConfig.direction
} }
return sort return sort
}), })
.filter((sort) => sort.field !== newSortConfig.field), // For now it is only single level of sorting so remove another sort field
] ]
} else { } else {
// Add a new sort configuration if the field does not exist // Add a new sort configuration
sorts.value = [...clone(sorts.value), newSortConfig] sorts.value = [newSortConfig]
} }
} else { } else {
if (fieldIndex !== -1) { if (fieldIndex !== -1) {

Loading…
Cancel
Save