From a8617d4c86993e80b020b847c9b0cdd2da8473c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 27 Jun 2013 17:28:25 +0200 Subject: [PATCH] =?utf8?q?bei=20enter=20und=20nicht=20eindeutig=20->=20dia?= =?utf8?q?log=20=C3=B6ffnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- js/autocomplete_part.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) 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); }); }) -- 2.20.1