From fc3d64d4483693c4f66bb1fc779c0e92330fc6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Tue, 15 Oct 2024 13:43:59 +0200 Subject: [PATCH] Fix reseting record list filter --- .../src/components/Common/RecordListFilter.vue | 8 ++++++-- .../src/components/PageBlocks/RecordListBase.vue | 13 +++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/client/web/compose/src/components/Common/RecordListFilter.vue b/client/web/compose/src/components/Common/RecordListFilter.vue index ff16dfa6bd..91e6a7f75d 100644 --- a/client/web/compose/src/components/Common/RecordListFilter.vue +++ b/client/web/compose/src/components/Common/RecordListFilter.vue @@ -615,6 +615,10 @@ export default { processFilter () { return this.componentFilter.map(({ groupCondition, filter = [], name }) => { filter = filter.map(({ record, ...f }) => { + if (!f.name) { + return + } + if (record) { f.value = record[f.name] || record.values[f.name] } @@ -627,10 +631,10 @@ export default { } return f - }) + }).filter(f => f) return { groupCondition, filter, name } - }) + }).filter(({ filter }) => filter.length) }, onSave (close = true, type = 'filter') { diff --git a/client/web/compose/src/components/PageBlocks/RecordListBase.vue b/client/web/compose/src/components/PageBlocks/RecordListBase.vue index e51386da68..914399d8cd 100644 --- a/client/web/compose/src/components/PageBlocks/RecordListBase.vue +++ b/client/web/compose/src/components/PageBlocks/RecordListBase.vue @@ -1139,11 +1139,16 @@ export default { }, onFilter (filter = []) { - filter.forEach(f => { - f.name = this.$t('recordList.customFilter') - }) + if (filter.length) { + filter.forEach(f => { + f.name = this.$t('recordList.customFilter') + }) + + this.activeFilters = [this.$t('recordList.customFilter')] + } else { + this.activeFilters = [] + } - this.activeFilters = [this.$t('recordList.customFilter')] this.recordListFilter = filter this.setStorageRecordListFilter() this.refresh(true)