diff --git a/src/components/datatable/ColumnFilter.vue b/src/components/datatable/ColumnFilter.vue
index f36037946..4785a023e 100644
--- a/src/components/datatable/ColumnFilter.vue
+++ b/src/components/datatable/ColumnFilter.vue
@@ -149,8 +149,8 @@ export default {
if (this.filters && this.filters[this.field]) {
let fieldFilters = this.filters[this.field];
if (fieldFilters.operator) {
- this.defaultMatchMode = this.filters[this.field].constraints[0].matchMode;
- this.defaultOperator = this.filters[this.field].operator;
+ this.defaultMatchMode = fieldFilters.constraints[0].matchMode;
+ this.defaultOperator = fieldFilters.operator;
}
else {
this.defaultMatchMode = this.filters[this.field].matchMode;
@@ -162,7 +162,8 @@ export default {
let _filters = {...this.filters};
if (_filters[this.field].operator) {
_filters[this.field].constraints.splice(1);
- _filters[this.field].constraints[0] = {value: null, matchMode: this.defaultMatchMode, operator: this.defaultOperator};
+ _filters[this.field].operator = this.defaultOperator;
+ _filters[this.field].constraints[0] = {value: null, matchMode: this.defaultMatchMode};
}
else {
_filters[this.field].value = null;
diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue
index 54f0920a0..924cdddd0 100755
--- a/src/components/datatable/DataTable.vue
+++ b/src/components/datatable/DataTable.vue
@@ -1715,7 +1715,9 @@ export default {
cloneFilters() {
let cloned = {};
if (this.filters) {
- cloned = JSON.parse(JSON.stringify(this.filters));
+ Object.entries(this.filters).forEach(([prop,value]) => {
+ cloned[prop] = value.operator ? {operator: value.operator, constraints: value.constraints.map(constraint => {return {...constraint}})} : {...value};
+ });
}
return cloned;
diff --git a/src/views/datatable/DataTableFilterDemo.vue b/src/views/datatable/DataTableFilterDemo.vue
index fc8ae3b19..2c2276aa5 100755
--- a/src/views/datatable/DataTableFilterDemo.vue
+++ b/src/views/datatable/DataTableFilterDemo.vue
@@ -81,7 +81,7 @@
{{formatDate(data.date)}}
-
+
@@ -160,7 +160,7 @@
{{data.name}}
-
+
@@ -197,6 +197,9 @@
+
+ {{slotProps.value}}
+
{{slotProps.option}}