2012-03-22 80 views

回答

0

怎么样像(没有测试过我自己)

客户端唯一的解决办法

<p:commandButton id="basic" onclick="jQuery('#IdOfThePanel').hide()"></p:commandButton> 

或客户端+服务器端

JSF:

<p:commandButton value="Save" actionListener="#{myBean.doSomething}"/> 

的java :

public void doSomething(ActionEvent actionEvent) { 

    RequestContext context = RequestContext.getCurrentInstance(); 
    context.execute("jQuery('#IdOfThePanel').hide()"); 
} 

这里看看上执行JS从Java

Executing Javascript from Server Side

PS的可能,而不是IdOfThePanel你必须添加一些前缀像formID:IdOfThePanel ......取决于你的情况...

编辑:不是的jQuery( '#IdOfThePanel')隐藏()只使用panelWidgetVar.hide()

+3

overlayPanelWidgetVar.hide()将更易于使用。 – 2012-03-22 22:17:40

+0

@Cagatay thx的小费, – Daniel 2012-03-22 22:34:48

0

将这个内部号码:overlayPanel标签,并设置号码: '为' ATTRIB效果与overlayPanel ID,使用appendToBody = true。

<p:commandLink styleClass="ui-icon ui-icon-triangle-1-e"> 
     <p:effect type="slide" for="idOverlayPanel" event="click"> 
      <f:param name="mode" value="'hide'"/> 
      <f:param name="direction" value="'right'"/> 
     </p:effect> 
    </p:commandLink> 

没有效果参数

<p:commandLink styleClass="ui-icon ui-icon-close" > 
    <p:effect type="slide" for="idOverlayPanel" event="click"/> 
</p:commandLink> 

您可以更改幻灯片效果anotherone,图标样式类了。

对不起我的英文不好

3

您可以轻松添加一个按钮,你overlaypanel到例如关闭

<p:overlayPanel widgetVar="myOverlayPanel" ... > 
    <p:commandButton ... onComplete="PF('myOverlayPanel').hide(); ... /> 
</p:overlayPanel> 

您也可以在Java中

private void doSomething() { 
    RequestContext ctx = RequestContext.getCurrentInstance(); 
    ctx.execute("PF('myOverlayPanel').hide();"); 
} 
0

做到这一点我与jQuery和CSS做到了这一点。请检查以下代码

<p:overlayPanel widgetVar="overlay" showEffect="blind" showCloseIcon="true" styleClass="lane-overlay" dynamic="true" dismissable="true" hideEffect="blind"> 
<script> 
$(document).ready(function(){ 
$(".closeIcon").click(function(){ 
$(".lane-overlay").hide(); 
}); 
}); 
</script> 
<p:commandButton value="close" styleClass="closeIcon"/> 
`enter code here`