fix(table view): do not sort table column fields when the field in question is hidden
Resolves https://kolaente.dev/vikunja/vikunja/issues/2272
This commit is contained in:
parent
84197dd9c1
commit
d86fdcb756
@ -267,7 +267,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, type Ref} from 'vue'
|
import {computed, type Ref, watch} from 'vue'
|
||||||
|
|
||||||
import {useStorage} from '@vueuse/core'
|
import {useStorage} from '@vueuse/core'
|
||||||
|
|
||||||
@ -337,6 +337,12 @@ Object.assign(params.value, {
|
|||||||
filter: '',
|
filter: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => activeColumns.value,
|
||||||
|
() => setActiveColumnsSortParam(),
|
||||||
|
{deep: true},
|
||||||
|
)
|
||||||
|
|
||||||
// FIXME: by doing this we can have multiple sort orders
|
// FIXME: by doing this we can have multiple sort orders
|
||||||
function sort(property: keyof SortBy) {
|
function sort(property: keyof SortBy) {
|
||||||
const order = sortBy.value[property]
|
const order = sortBy.value[property]
|
||||||
@ -347,7 +353,16 @@ function sort(property: keyof SortBy) {
|
|||||||
} else {
|
} else {
|
||||||
delete sortBy.value[property]
|
delete sortBy.value[property]
|
||||||
}
|
}
|
||||||
sortByParam.value = sortBy.value
|
setActiveColumnsSortParam()
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActiveColumnsSortParam() {
|
||||||
|
sortByParam.value = Object.keys(sortBy.value)
|
||||||
|
.filter(prop => activeColumns.value[prop])
|
||||||
|
.reduce((obj, key) => {
|
||||||
|
obj[key] = sortBy.value[key]
|
||||||
|
return obj
|
||||||
|
}, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: re-enable opening task detail in modal
|
// TODO: re-enable opening task detail in modal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user