@@ -147,6 +149,7 @@ export default {
}
this.$emit('filtermeta-change', _filters);
+ this.hide();
},
applyFilter() {
let _filters = {...this.filters};
@@ -259,10 +262,6 @@ export default {
else
return item.parentElement.lastElementChild;
},
- onRowClearItemClick() {
- this.clearFilter();
- this.hide();
- },
hide() {
this.overlayVisible = false;
},
@@ -360,12 +359,12 @@ export default {
},
addConstraint() {
let _filters = {...this.filters};
- _filters[this.field].push({value: null, matchMode: this.defaultMatchMode()});
+ _filters[this.field].push({value: null, matchMode: this.defaultMatchMode});
this.$emit('filtermeta-change', _filters);
},
- removeConstraint(filterMeta) {
+ removeConstraint(index) {
let _filters = {...this.filters};
- _filters[this.field] = _filters[this.field].filter(meta => meta !== filterMeta);
+ _filters[this.field].splice(index, 1);
this.$emit('filtermeta-change', _filters);
}
},
diff --git a/src/components/overlaypanel/OverlayPanel.vue b/src/components/overlaypanel/OverlayPanel.vue
index 1c6b8ce26..1cf15a3e2 100755
--- a/src/components/overlaypanel/OverlayPanel.vue
+++ b/src/components/overlaypanel/OverlayPanel.vue
@@ -170,7 +170,7 @@ export default {
this.resizeListener = null;
}
},
- isTargetClicked() {
+ isTargetClicked(event) {
return this.target && (this.target === event.target || this.target.contains(event.target));
},
appendContainer() {
diff --git a/src/views/datatable/DataTableFilterDemo.vue b/src/views/datatable/DataTableFilterDemo.vue
index bec1e8ae3..b02c4282f 100755
--- a/src/views/datatable/DataTableFilterDemo.vue
+++ b/src/views/datatable/DataTableFilterDemo.vue
@@ -14,8 +14,9 @@
-
-
+
+
+
@@ -32,8 +33,8 @@
Name
{{slotProps.data.name}}
-
-
+
+
@@ -42,8 +43,8 @@
{{slotProps.data.country.name}}
-
-
+
+
@@ -227,17 +228,7 @@ export default {
return {
customers1: null,
customers2: null,
- filters1: {
- 'global': {value: null, matchMode: FilterMatchMode.CONTAINS},
- 'name': [{value: null, matchMode: FilterMatchMode.STARTS_WITH, operator: FilterOperator.AND}],
- 'country.name': [{value: null, matchMode: FilterMatchMode.STARTS_WITH, operator: FilterOperator.AND}],
- 'representative': [{value: null, matchMode: FilterMatchMode.IN}],
- 'date': [{value: null, matchMode: FilterMatchMode.IS, operator: FilterOperator.AND}],
- 'balance': [{value: null, matchMode: FilterMatchMode.EQUALS, operator: FilterOperator.AND}],
- 'status': [{value: null, matchMode: FilterMatchMode.EQUALS, operator: FilterOperator.AND}],
- 'activity': [{value: [0,100], matchMode: FilterMatchMode.BETWEEN}],
- 'verified': [{value: null, matchMode: FilterMatchMode.EQUALS, operator: FilterOperator.AND}]
- },
+ filters1: null,
filters2: {
'global': {value: null, matchMode: FilterMatchMode.CONTAINS},
'name': {value: null, matchMode: FilterMatchMode.STARTS_WITH},
@@ -267,6 +258,7 @@ export default {
},
created() {
this.customerService = new CustomerService();
+ this.initFilters1();
},
mounted() {
this.customerService.getCustomersLarge().then(data => {this.customers1 = data; this.loading1 = false;});
@@ -275,6 +267,22 @@ export default {
methods: {
formatCurrency(value) {
return value.toLocaleString('en-US', {style: 'currency', currency: 'USD'});
+ },
+ clearFilter1() {
+ this.initFilters1();
+ },
+ initFilters1() {
+ this.filters1 = {
+ 'global': {value: null, matchMode: FilterMatchMode.CONTAINS},
+ 'name': [{value: null, matchMode: FilterMatchMode.STARTS_WITH, operator: FilterOperator.AND}],
+ 'country.name': [{value: null, matchMode: FilterMatchMode.STARTS_WITH, operator: FilterOperator.AND}],
+ 'representative': [{value: null, matchMode: FilterMatchMode.IN}],
+ 'date': [{value: null, matchMode: FilterMatchMode.IS, operator: FilterOperator.AND}],
+ 'balance': [{value: null, matchMode: FilterMatchMode.EQUALS, operator: FilterOperator.AND}],
+ 'status': [{value: null, matchMode: FilterMatchMode.EQUALS, operator: FilterOperator.AND}],
+ 'activity': [{value: [0,100], matchMode: FilterMatchMode.BETWEEN}],
+ 'verified': [{value: null, matchMode: FilterMatchMode.EQUALS}]
+ }
}
}
}