From: Sven Schöling Date: Mon, 15 Jul 2013 14:08:09 +0000 (+0200) Subject: make_defined_state auch beim Klicken ausserhalb des Pickers X-Git-Tag: release-3.1.0beta1~161^2~55 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5729856b2a3b4aeecda843329939363dcd08ae6f;p=kivitendo-erp.git make_defined_state auch beim Klicken ausserhalb des Pickers Problem war, dass ein einfacher blur handler auch getriggert hat wenn das jqm aufgeht. Dafür ist der timermechanismus jetzt mit ins widget gewandert und der blur handler wird einfach abgebrochen --- diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index 0a4886f17..b89751e3b 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -26,7 +26,9 @@ namespace('kivi', function(k){ var state = STATES.PICKED; var last_real = $real.val(); var last_dummy = $dummy.val(); - var open_dialog = function(){ + var timer; + + function open_dialog () { open_jqm_window({ url: 'controller.pl?action=Part/part_picker_search', data: $.extend({ @@ -34,8 +36,9 @@ namespace('kivi', function(k){ }, ajax_data($dummy.val())), id: 'part_selection', }); + window.clearTimeout(timer); return true; - }; + } function ajax_data(term) { var data = { @@ -89,6 +92,11 @@ namespace('kivi', function(k){ }); }; + function result_timer (event) { + window.clearTimeout(timer); + timer = window.setTimeout(update_results, 100); + } + function close_popup() { $('#part_selection').jqmClose() }; @@ -156,7 +164,10 @@ namespace('kivi', function(k){ } }); -// $dummy.blur(make_defined_state); // blur triggers also on open_jqm_dialog + $dummy.blur(function(){ + window.clearTimeout(timer); + timer = window.setTimeout(make_defined_state, 100); + }); // now add a picker div after the original input var pcont = $('').addClass('position-absolute'); @@ -173,6 +184,7 @@ namespace('kivi', function(k){ convertible_unit: function() { return $convertible_unit }, column: function() { return $column }, update_results: update_results, + result_timer: result_timer, set_item: set_item, reset: make_defined_state, init_results: function () { diff --git a/templates/webpages/part/part_picker_search.html b/templates/webpages/part/part_picker_search.html index a3cf40618..318c95e10 100644 --- a/templates/webpages/part/part_picker_search.html +++ b/templates/webpages/part/part_picker_search.html @@ -14,14 +14,10 @@