Primefaces的对话框"appendTo"属性,它有什么用? [英] Primefaces's dialog 'appendTo' property, what it useful for?

查看:123
本文介绍了Primefaces的对话框"appendTo"属性,它有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许这是一个愚蠢的问题,但是在Primefaces的<p:dialog>中有一个名为appendTo的属性,该属性在手册中描述为:

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?

推荐答案

来自 PrimeFaces用户指南(当前第185页):

From the PrimeFaces User Guide (currently p. 185):

请勿在表格内放置对话框,容器应相对定位或不可见,例如div 定义的溢出,以防这些功能被破坏.这不是限制 但是是DOM模型的结果.例如,布局单元内的对话框,tabview,手风琴是一个 几个例子.同样适用于confirmDialog.

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.

您可以通过使用appendTo="@(body)"克服此问题,并且您的dialog将作为<body>节点的子代附加.

You can overcome this by using appendTo="@(body)" and your dialog will be attached as a child of the <body> node.

dialog的主要选项之一是modal,如果您不使用appendTo,则可以很快在覆盖层后面出现对话框,如下所示:

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:

另请参见 http://forum.primefaces.org/viewtopic. php?f = 3& t = 16504

注释:

  • 在PrimeFaces 5.0之前,要设置的属性为appendToBody="true".更改为5.0.
  • 如果您的dialog包含一些按钮,请不要忘了用<h:form>包围它们(请参阅
  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆