Skip to content

Commit 15d137f

Browse files
committed
1 parent 19b27bc commit 15d137f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/org/primefaces/component/overlaypanel/OverlayPanelRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected void encodeScript(FacesContext context, OverlayPanel panel) throws IOE
7878
.callback("onHide", "function()", panel.getOnHide())
7979
.attr("my", panel.getMy(), null)
8080
.attr("at", panel.getAt(), null)
81-
.attr("appendToBody", panel.isAppendToBody(), false)
81+
.attr("appendTo", panel.getAppendTo(), null)
8282
.attr("dynamic", panel.isDynamic(), false)
8383
.attr("dismissable", panel.isDismissable(), true)
8484
.attr("showCloseIcon", panel.isShowCloseIcon(), false)

src/main/resources-maven-jsf/ui/overlayPanel.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@
6464
<description>Effect to display when hiding the panel.</description>
6565
</attribute>
6666
<attribute>
67-
<name>appendToBody</name>
67+
<name>appendTo</name>
6868
<required>false</required>
69-
<type>java.lang.Boolean</type>
70-
<defaultValue>false</defaultValue>
71-
<description>When set true, panel is appended as a child of document body.</description>
69+
<type>java.lang.String</type>
70+
<description>Alternative to appendToBody. Appends the overlayPanel to the given search expression.</description>
7271
</attribute>
7372
<attribute>
7473
<name>onShow</name>

src/main/resources/META-INF/resources/primefaces/overlaypanel/overlaypanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
3838
}
3939

4040
if(this.cfg.appendToBody) {
41-
this.jq.appendTo(document.body);
41+
var appendTo = PrimeFaces.expressions.SearchExpressionFacade.resolveComponentsAsSelector(this.cfg.appendTo);;
42+
this.jq.appendTo(appendTo);
4243
}
4344

4445
this.bindCommonEvents();
@@ -277,7 +278,7 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
277278
this.jq.css('position', 'fixed');
278279

279280
//append to body if not already appended by user choice
280-
if(!this.cfg.appendToBody) {
281+
if(!this.cfg.appendTo) {
281282
this.jq.appendTo(document.body);
282283
}
283284
}

0 commit comments

Comments
 (0)