From 6891cdeeeafceeaef1bc63c763c34e5867533b37 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Tue, 30 Aug 2011 05:56:52 +0000 Subject: [PATCH] A patch from Leon "improve the behavior of nested lookup dialogs (ajax mode) " https://issues.apache.org/jira/browse/OFBIZ-4380 Nested lookup dialogs: in one lookup dialog, it opens another lookup dialog. trivial improvements: 1. "enter" event only occurs to lookup dialog itself 2. if mouse click out side the lookup dialog, only current activated dialog closes git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1163093 13f79535-47bb-0310-9956-ffa450edef68 --- framework/images/webapp/images/fieldlookup.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/images/webapp/images/fieldlookup.js b/framework/images/webapp/images/fieldlookup.js index af92f8b312..92d5906156 100644 --- a/framework/images/webapp/images/fieldlookup.js +++ b/framework/images/webapp/images/fieldlookup.js @@ -261,7 +261,7 @@ function ConstructLookup(requestUrl, inputFieldId, dialogTarget, dialogOptionalT jQuery("#" + lookupId).load(requestUrlAndArgs, function(data){ lookupFormAction = jQuery("#" + lookupId + " form:first").attr("action"); modifySubmitButton(lookupId); - jQuery(document).bind("keypress", lookup_onKeyEnter); + jQuery("#" + lookupId).bind("keypress", lookup_onKeyEnter); // set up the window chaining // if the ACTIVATED_LOOKUP var is set there have to be more than one lookup, // before registrating the new lookup we store the id of the old lookup in the @@ -279,7 +279,7 @@ function ConstructLookup(requestUrl, inputFieldId, dialogTarget, dialogOptionalT }); }, close: function() { - jQuery(document).unbind("keypress", lookup_onKeyEnter); + jQuery("#" + lookupId).unbind("keypress", lookup_onKeyEnter); //when the window is closed the prev Lookup get the focus (if exists) if (ACTIVATED_LOOKUP) { var prevLookup = GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).prevLookup; @@ -324,7 +324,11 @@ function ConstructLookup(requestUrl, inputFieldId, dialogTarget, dialogOptionalT ); // close the dialog when clicking outside the dialog area - jQuery(".ui-widget-overlay").live("click", function() { jQuery("#" + lookupId).dialog("close"); } ); + jQuery(".ui-widget-overlay").live("click", function() { + if(!ACTIVATED_LOOKUP || lookupId==ACTIVATED_LOOKUP){ + jQuery("#" + lookupId).dialog("close"); + } + }); }