From e9440d0d4c051e63c84c2cdaba2ec81bbf231dd4 Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Thu, 19 Apr 2018 07:37:11 +0000 Subject: [PATCH] Advanced search: Fix criteria closed after search modal. SVN:trunk[5695] --- js/search/search_form_criteria.js | 17 +++++++++-------- js/search/search_form_criteria_enum.js | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index c3f0b342d..ef432d7c5 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -101,14 +101,6 @@ $(function() this._super( key, value ); }, - _initChooseDefaultOperator: function() { - //if the class has an index, in order to maximize the performance, we force the default operator to "equal" - if (this.options.field.has_index && typeof this.options.available_operators['='] == 'object') - { - this.options.operator = '='; - this.options.available_operators['='].rank = -1;//we want it to be the first displayed - } - }, // Protected methods // - Init operators by cleaning up available operators and ordering them. // Note: A null operator or an operator with a rank "false" will be removed. @@ -157,6 +149,15 @@ $(function() this.options.operator = Object.keys(this.operators)[0]; } }, + _initChooseDefaultOperator: function() + { + //if the class has an index, in order to maximize the performance, we force the default operator to "equal" + if (this.options.field.has_index && typeof this.options.available_operators['='] == 'object') + { + this.options.operator = '='; + this.options.available_operators['='].rank = -1;//we want it to be the first displayed + } + }, // - Bind external events _bindEvents: function() { diff --git a/js/search/search_form_criteria_enum.js b/js/search/search_form_criteria_enum.js index db7166f74..15fe9da9c 100644 --- a/js/search/search_form_criteria_enum.js +++ b/js/search/search_form_criteria_enum.js @@ -91,7 +91,9 @@ $(function() _onAddSelectedValues: function(oData) { this._addSelectedValues(oData); - //this._apply(); + // Note: Selecting values elsewhere (eg. a popup) closes the criteria on the first click, so when the user goes back to the form, the criteria has the new values displayed but not selected. So as a workaround we apply and re-open the criteria. + this._apply(); + this._open(); }, // DOM element helpers