From 1eb174d3f72e1a1dffaa3b365c470192d0333d82 Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 25 Feb 2021 13:59:32 -0700 Subject: [PATCH] For push update filter, consider empty array as having no value --- api/js/jsapi/egw_app.js | 18 +++++++++--------- api/js/jsapi/egw_app.ts | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/api/js/jsapi/egw_app.js b/api/js/jsapi/egw_app.js index 2c7adad136..d2ee386509 100644 --- a/api/js/jsapi/egw_app.js +++ b/api/js/jsapi/egw_app.js @@ -243,15 +243,15 @@ var EgwApp = /** @class */ (function () { }; } // Get current filter values - if (this.et2) { - var value = nm.getValue(); - if (!value || !value.col_filter) - return false; - for (var _i = 0, _a = Object.values(filters); _i < _a.length; _i++) { - var field_filter = _a[_i]; - if (value.col_filter[field_filter.col]) { - field_filter.filter_values.push(value.col_filter[field_filter.col]); - } + var value = nm.getValue(); + if (!value || !value.col_filter) + return false; + for (var _i = 0, _a = Object.values(filters); _i < _a.length; _i++) { + var field_filter = _a[_i]; + var val = value.col_filter[field_filter.col]; + if (val && (typeof val == "string" && val.trim().length > 0 || + typeof val == "object" && !jQuery.isEmptyObject(val))) { + field_filter.filter_values.push(val); } } var _loop_2 = function (field_filter) { diff --git a/api/js/jsapi/egw_app.ts b/api/js/jsapi/egw_app.ts index 6bd09d8d8b..44eb7a0adb 100644 --- a/api/js/jsapi/egw_app.ts +++ b/api/js/jsapi/egw_app.ts @@ -373,17 +373,18 @@ export abstract class EgwApp } // Get current filter values - if(this.et2) - { - let value = nm.getValue(); - if(!value || !value.col_filter) return false; + let value = nm.getValue(); + if(!value || !value.col_filter) return false; - for(let field_filter of Object.values(filters)) + for(let field_filter of Object.values(filters)) + { + let val = value.col_filter[field_filter.col]; + if(val && ( + typeof val == "string" && val.trim().length > 0 || + typeof val == "object" && !jQuery.isEmptyObject(val) + )) { - if(value.col_filter[field_filter.col]) - { - field_filter.filter_values.push(value.col_filter[field_filter.col]); - } + field_filter.filter_values.push(val); } }