Author: pyaschenko
Date: 2010-07-20 07:43:50 -0400 (Tue, 20 Jul 2010)
New Revision: 18156
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
Log:
https://jira.jboss.org/browse/RF-8875
attachToBody javascript options was added
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
===================================================================
---
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20
11:40:39 UTC (rev 18155)
+++
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20
11:43:50 UTC (rev 18156)
@@ -206,9 +206,14 @@
show: function (event) {
if (!this.isVisible) {
if (this.onBeforeShow(event)!=false) {
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide,
this, this.namespace);
+ if (this.options.attachToBody) {
+ var element = rf.getDomElement(this.selectId);
+ this.parentElement = element.parentNode;
+ $(element).detach().appendTo("body");
+ }
$(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId},
{type:"DROPDOWN", offset:[0,20]}).show();
this.isVisible = true;
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide,
this, this.namespace);
if (this.onShow) {
this.onShow(event);
}
@@ -220,6 +225,10 @@
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
$(rf.getDomElement(this.selectId)).hide();
this.isVisible = false;
+ if (this.options.attachToBody && this.parentElement) {
+ $(rf.getDomElement(this.selectId)).detach().appendTo(this.parentElement);
+ this.parentElement = null;
+ }
if (this.onHide) {
this.onHide(event);
}
@@ -227,8 +236,10 @@
},
destroy: function () {
//TODO: add all unbind
+ this.parentNode = null;
rf.Event.unbindById(this.options.buttonId, this.namespace);
rf.Event.unbindById(this.fieldId, this.namespace);
+ rf.Event.unbindById(this.selectId, this.namespace);
$super.destroy.call(this);
},
getNamespace: function () {