From: Sven Schöling Date: Thu, 27 Jun 2013 15:28:25 +0000 (+0200) Subject: bei enter und nicht eindeutig -> dialog öffnen X-Git-Tag: release-3.1.0beta1~192 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a8617d4c86993e80b020b847c9b0cdd2da8473c6;p=kivitendo-erp.git bei enter und nicht eindeutig -> dialog öffnen --- diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index f7fe0d520..451f96406 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -25,6 +25,22 @@ $(function(){ $dummy.val(ui.item.name); }, }); + + var open_dialog = function(){ + open_jqm_window({ + url: 'controller.pl', + data: { + action: 'Part/part_picker_search', + real_id: function() { return $(real).attr('id') }, + 'filter.all:substr::ilike': function(){ return $dummy.val() }, + 'filter.type': function(){ return $type.val() }, + 'column': function(){ return $column.val() }, + 'real_id': function() { return real.id }, + }, + id: 'part_selection', + }); + return true; + }; /* In case users are impatient and want to skip ahead: * Capture key events and check if it's a unique hit. * If it is, go ahead and assume it was selected. If it wasn't don't do @@ -57,6 +73,8 @@ $(function(){ $dummy.val(data[0].description); if (event.keyCode == 13) $('#update_button').click(); + } else { + open_dialog(); } } }); @@ -68,27 +86,13 @@ $(function(){ $dummy.blur(function(){ if ($dummy.val() == '') $(real).val(''); - }) + }); // now add a picker div after the original input var pcont = $('').addClass('position-absolute'); var picker = $('
'); $dummy.after(pcont); pcont.append(picker); - picker.addClass('icon16 CRM--Schnellsuche').click(function(){ - open_jqm_window({ - url: 'controller.pl', - data: { - action: 'Part/part_picker_search', - real_id: function() { return $(real).attr('id') }, - 'filter.all:substr::ilike': function(){ return $dummy.val() }, - 'filter.type': function(){ return $type.val() }, - 'column': function(){ return $column.val() }, - 'real_id': function() { return real.id }, - }, - id: 'part_selection', - }); - return true; - }); + picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog); }); })