从iframe按钮关闭lightBox Primefaces [英] Close a lightBox primefaces from iframe Button

查看:105
本文介绍了从iframe按钮关闭lightBox Primefaces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有接缝的primefaces灯箱组件. 我有一个firstpage.xhtml页面,其中有一个显示带有iframe参数的灯箱的按钮,该按钮将显示具有某些表单字段的"secondpage.xhtml"和一个关闭窗口"按钮.

I use primefaces lightbox component with seam. I have a firstpage.xhtml page, where I have a button that display a lightbox with iframe parameter, that will display a secondpage.xhtml that have some form fields and a "Close Window" button.

firstpage.xhtml的代码

Code of firstpage.xhtml

>  <ui:composition xmlns="http://www.w3.org/1999/xhtml"
>   xmlns:ui="http://java.sun.com/jsf/facelets"
>   xmlns:h="http://java.sun.com/jsf/html"
>   xmlns:f="http://java.sun.com/jsf/core"
>   xmlns:p="http://primefaces.prime.com.tr/ui"
>   xmlns:opt="http://primefaces.prime.com.tr/optimus"
>   template="layout/template1.xhtml"> <ui:define name="head">
> <p:resources/> </ui:define>
>               <ui:define name="body">
>   
>           <h1 class="title">LightBox - External URL</h1>      <div class="entry">
>               <p>LightBox can display external urls in an iframe.</p>
>                   
>                   <p:lightBox id="light" iframe="true" width="80%" height="80%" widgetVar="dlg">
>                   
>                         <h:outputLink value="#{request.contextPath}/PermissionEdit.seam" title="PrimeFaces
> HomePage">
>                           <h:outputText value="PrimeFaces HomePage"/>
>                       </h:outputLink>
>                   </p:lightBox>
> 
>               <h3>Source</h3> <pre name="code" class="xml"> &lt;p:lightBox iframe="true" width="80%" height="80%"&gt;     &lt;h:outputLink
> value="http://primefaces.org" title="PrimeFaces HomePage"&gt; 
>       &lt;h:outputText value="PrimeFaces HomePage"/&gt; 
>   &lt;/h:outputLink&gt;  &lt;/p:lightBox&gt; </pre>
> 
> </div> </ui:define> </ui:composition>

请问有人在我单击secondpage.xhtml上的关闭按钮时,如何实现关闭此灯箱iframe窗口的关闭方法吗?

Could please someone tell me how to implement a close method to close this lightbox iframe window when i click on the close button on the secondpage.xhtml?

预先感谢

推荐答案

重新加载页面可能非常昂贵:

Reloading a page could be very expensive:

onclick="javascript:window.parent.location.reload(true);"

您可以使用略有不同的方法:

You can use slightly different approach:

<p:lightBox id="light" iframe="true" width="80%" height="80%" widgetVar="dlg">

在iframe一侧:

<p:commandButton value="Close" onsuccess="parent.dlg.hide();" ajax="true" process="@none" />

这篇关于从iframe按钮关闭lightBox Primefaces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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