Primefaces动态overlayPanel仅显示一次 [英] Primefaces dynamic overlayPanel showing only once

查看:103
本文介绍了Primefaces动态overlayPanel仅显示一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有按钮的表单,该按钮可打开Primafaces overlayPanel. 面板中还有另一个按钮,该按钮执行Ajax操作,然后关闭覆盖.
这是一个完全没有Ajax操作的简化版本:

I have a form with a button that opens a Primafaces overlayPanel. In the panel there is another button that performs an Ajax action and then closes the overlay.
Here is a simplified version with no Ajax action at all:

<h:form>
    <p:commandButton id="button1" value="Open overlay" type="button"/>
    <p:overlayPanel for="button1" widgetVar="ovl" dynamic="true">
        <p:commandButton value="Close" oncomplete="ovl.hide();"
                         update="@form"/>
    </p:overlayPanel>
</h:form>

请注意,面板必须具有dynamic="true",因为必须在实际应用程序中获取动态内容,并且需要update="@form"才能更新其他表单组件.

Please note that the panel must have dynamic="true" because dynamic content must be fetched in the real application, and update="@form" is needed in order to update other form components.

问题是:如果我同时拥有两个服装,则dynamic="true"update="@form"覆盖物只会在第一次出现.单击关闭"按钮后,如果我再次尝试单击打开叠加层",则该面板将不会显示.

The problem is: if I have both attibutes, dynamic="true" and update="@form" the overlay shows up only the first time. After clicking the "close" button, if I try to click on "open overlay" once more, the panel won't show up.

我做错了什么?

(使用PrimeFaces 3.5和GlassFish 3.1.2.2)

(Using PrimeFaces 3.5 and GlassFish 3.1.2.2)

推荐答案

在下拉overlaypanel的按钮中使用onclick="widgetVar.loadContents()",其中widgetVaroverlayPanel的变量.

Use onclick="widgetVar.loadContents()" in the button dropping down the overlaypanel, where widgetVar is the var of the overlayPanel.

这篇关于Primefaces动态overlayPanel仅显示一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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