From dfab460478fdf703473c585deca6aea3555506a5 Mon Sep 17 00:00:00 2001 From: Bruno Da Silva Date: Thu, 29 Mar 2018 10:12:20 +0000 Subject: [PATCH] search widget : bugfix if the selected operator is not the default one, open in "advanced" mode in order to be able to see the operator SVN:b1162[5571] --- js/search/search_form_criteria.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index 407b1bc3e..1becbc9a5 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -189,16 +189,14 @@ $(function() } // Focus on right input - var oOpElemToFocus; - if(this.element.find('.sfc_form_group').hasClass('advanced')) + var oOpElemRadioChecked = this.element.find('.sfc_fg_operator .sfc_op_radio:checked'); + + if (!oOpElemRadioChecked.is(':visible')) { - oOpElemToFocus = this.element.find('.sfc_fg_operator .sfc_op_radio:checked').closest('.sfc_fg_operator'); + this.element.find('.sfc_form_group').addClass('advanced'); } - else - { - oOpElemToFocus = this.element.find('.sfc_fg_operator:first'); - } - oOpElemToFocus.find('.sfc_op_content input[type="text"]:first').filter(':not([data-no-auto-focus])').trigger('click').trigger('focus'); + + oOpElemRadioChecked.closest('.sfc_fg_operator').find('.sfc_op_content input[type="text"]:first').filter(':not([data-no-auto-focus])').trigger('click').trigger('focus'); }, _close: function() {