From 1ba1bb1a549b0ba46a19c3754ad9aa9eea81cb14 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Mon, 8 Feb 2021 14:07:06 +0300 Subject: [PATCH] Use filters store to display a filled in filter --- src/components/datatable/ColumnFilter.vue | 22 ++++++++++++++-------- src/components/datatable/DataTable.vue | 2 +- src/components/datatable/TableHeader.vue | 8 ++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/datatable/ColumnFilter.vue b/src/components/datatable/ColumnFilter.vue index a0a13975a..836382e73 100644 --- a/src/components/datatable/ColumnFilter.vue +++ b/src/components/datatable/ColumnFilter.vue @@ -9,7 +9,7 @@
- + - +
@@ -111,6 +111,10 @@ export default { type: Object, default: null }, + filtersStore: { + type: Object, + default: null + }, filterMenuClass: { type: String, default: null @@ -168,12 +172,14 @@ export default { this.hide(); }, hasFilter() { - let fieldFilter = this.filters[this.field]; - if (fieldFilter) { - if (fieldFilter.operator) - return !this.isFilterBlank(fieldFilter.constraints[0].value); - else - return !this.isFilterBlank(fieldFilter.value); + if (this.filtersStore) { + let fieldFilter = this.filtersStore[this.field]; + if (fieldFilter) { + if (fieldFilter.operator) + return !this.isFilterBlank(fieldFilter.constraints[0].value); + else + return !this.isFilterBlank(fieldFilter.value); + } } return false; diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index ba6adc23c..9fb526365 100755 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -20,7 +20,7 @@ diff --git a/src/components/datatable/TableHeader.vue b/src/components/datatable/TableHeader.vue index df575cc6f..674ee1bac 100755 --- a/src/components/datatable/TableHeader.vue +++ b/src/components/datatable/TableHeader.vue @@ -17,7 +17,7 @@ @@ -30,7 +30,7 @@ :class="getFilterColumnHeaderClass(col)" :style="columnProp(col, 'filterHeaderStyle')"> @@ -112,6 +112,10 @@ export default { type: Object, default: null }, + filtersStore: { + type: Object, + default: null + }, filterDisplay: { type: String, default: null