From 7031a52a433b8e82796d2ce343aec85566d61590 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Wed, 13 Jun 2018 09:49:49 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B01499=20:=20Edge=20case=20where=20picking?= =?UTF-8?q?=20a=20datetime=20and=20pressing=20enter=20would=20not=20close?= =?UTF-8?q?=20the=20criterion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[5857] --- js/search/search_form_criteria.js | 2 +- .../search_form_criteria_date_abstract.js | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index 131b833f9..377b71b3b 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -184,7 +184,7 @@ $(function() } else { - console.log('search form criteria: callback type must be a function or a existing function name of the widget'); + me._trace('search form criteria: callback type must be a function or a existing function name of the widget'); return false; } }); diff --git a/js/search/search_form_criteria_date_abstract.js b/js/search/search_form_criteria_date_abstract.js index 8c16c6668..e2e8afb73 100644 --- a/js/search/search_form_criteria_date_abstract.js +++ b/js/search/search_form_criteria_date_abstract.js @@ -114,7 +114,7 @@ $(function() .attr('for', oInputElem.attr('id')) ; - //no arrivla, the date is always formated yyy-mm-dd, we need to apply the user's formating and to write it into both the dom and the values array. + //on arrival, the date is always formated yyy-mm-dd, we need to apply the user's formating and to write it into both the dom and the values array. if (oInputParam.value_index in aValues && typeof aValues[oInputParam.value_index].value != 'undefined' && aValues[oInputParam.value_index].value != '') { //ie9 do not hadle the timezone like the other browsers, so wee need to make extra computation in order to be sure to obtain consistency accross browsers : we declare the date without the UTC offset (the suffix "Z", then wee add the timezone offset @@ -128,30 +128,30 @@ $(function() } oContentElem = oContentElem.add(oOpContentElem); + + // - Apply on "enter" key hit + //todo: this could be refactored + oOpContentElem.on('keyup', function(oEvent){ + // Check operator's radio if not already (typically when focusing in input via "tab" key) + if(oOpElem.find('.sfc_op_radio').prop('checked') === false) + { + oOpElem.find('.sfc_op_radio').prop('checked', true) + } + + me._markAsDraft(); + + // Apply if enter key + if(oEvent.key === 'Enter') + { + var inputElem = $(this).find('input[type="text"]'); + inputElem.val(inputElem.val().trim()); + inputElem[oInputParam.x_picker]('hide'); + //Closing the criterion because the datetime picker widget catches the keydown event + me._close(); + me._apply(); + } + }); } - - - - // - Apply on "enter" key hit - //todo: this could be refactored - oOpContentElem.on('keyup', function(oEvent){ - // Check operator's radio if not already (typically when focusing in input via "tab" key) - if(oOpElem.find('.sfc_op_radio').prop('checked') === false) - { - oOpElem.find('.sfc_op_radio').prop('checked', true) - } - - me._markAsDraft(); - - // Apply if enter key - if(oEvent.key === 'Enter') - { - var inputElem = $(this).find('input[type="text"]'); - inputElem.val(inputElem.val().trim()); - me._apply(); - } - }); - oOpElem .find('.sfc_op_name') .remove()