Primefaces 的对话框 'appendTo' 属性,它有什么用? [英] Primefaces's dialog 'appendTo' property, what it useful for?
问题描述
也许这是一个愚蠢的问题,但在 Primefaces 的 <p:dialog>
中有一个名为 appendTo
的属性,它在手册中描述为:
将对话框附加到给定搜索定义的元素表达.
我不明白它有什么用?
来自
<小时>注意事项:
- 在 PrimeFaces 5.0 之前,要设置的属性是
appendToBody="true"
.这在 5.0 中已更改. - 如果您的
dialog
包含一些按钮,请不要忘记用
包围它们(请参阅 Primefaces 对话框的正确构造)
Maybe it's a dumb question, but in Primefaces's <p:dialog>
there's property which called appendTo
which described in manual as:
Appends the dialog to the element defined by the given search expression.
I can't realize what it useful for?
From the PrimeFaces User Guide (currently p. 185):
Do not place dialog inside tables, containers likes divs with relative positioning or with nonvisible overflow defined, in cases like these functionality might be broken. This is not a limitation but a result of DOM model. For example dialog inside a layout unit, tabview, accordion are a couple of examples. Same applies to confirmDialog as well.
You can overcome this by using appendTo="@(body)"
and your dialog
will be attached as a child of the <body>
node.
One of the main dialog
option is modal
and you could quickly end up with your dialog behind the overlay if you are not using appendTo
as shown below:
See also http://forum.primefaces.org/viewtopic.php?f=3&t=16504
Notes:
- Before PrimeFaces 5.0, the attribute to set was
appendToBody="true"
. This was changed for 5.0. - If your
dialog
contains some buttons don't forget to surround them by<h:form>
(see Proper Construct for Primefaces Dialog)
这篇关于Primefaces 的对话框 'appendTo' 属性,它有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!