Author: jleroux
Date: Fri Feb 5 10:23:11 2010
New Revision: 906893
URL:
http://svn.apache.org/viewvc?rev=906893&view=revLog:
A patch from Sascha Rodekamp "New Lookup Layer - Click and Close" (
https://issues.apache.org/jira/browse/OFBIZ-3431) - OFBIZ-3431
Modified:
ofbiz/trunk/framework/images/webapp/images/fieldlookup.js
Modified: ofbiz/trunk/framework/images/webapp/images/fieldlookup.js
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/fieldlookup.js?rev=906893&r1=906892&r2=906893&view=diff==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/fieldlookup.js Fri Feb 5 10:23:11 2010
@@ -168,6 +168,13 @@
}
}
+//checks if a lookup can be closed if the mouse is clicking beside the lookup layer
+function close_on_click(evt) {
+ if (! Event.element(evt).descendantOf(CURRENT_LOOKUP.divRef)) {
+ lookupHide();
+ }
+}
+
/**
* Class to create a lookup layer
* target - target where the value should be passed
@@ -203,6 +210,7 @@
this.position = position;
this.createElement();
+ Event.observe(document, "mousedown", close_on_click);
CURRENT_LOOKUP = this;
},
@@ -370,6 +378,7 @@
removeLayer: function () {
this.loopupDrag.destroy();
Element.stopObserving(document, "keypress");
+ Element.stopObserving(document, "mousedown");
CURRENT_LOOKUP.divRef.parentNode.removeChild(CURRENT_LOOKUP.divRef);
CURRENT_LOOKUP = null;
this.target = null;
@@ -414,6 +423,7 @@
this.position = position;
this.createElement();
+ Event.observe(document, "mousedown", close_on_click);
CURRENT_LOOKUP = this;
},
@@ -577,6 +587,7 @@
removeLayer: function () {
this.loopupDrag.destroy();
Element.stopObserving(document, "keypress");
+ Element.stopObserving(document, "mousedown");
CURRENT_LOOKUP.divRef.parentNode.removeChild(CURRENT_LOOKUP.divRef);
CURRENT_LOOKUP = null;
this.target = null;