【问题标题】:Haw can I close notificationBar Primefaces如何关闭通知栏 Primefaces
【发布时间】:2013-06-14 13:31:34
【问题描述】:

我卡在notifatiionBar上。我喜欢在他显示后关闭它。像这个例子一样用icnon按钮

primefaces-rocks.appspot.com/ui/notificationBar.jsf#

<p:commandButton value="Enregistrer Parametre" action="#{optionBean.updateParametre()}" oncomplete="bar.show()" update="panel"/>
    <p:notificationBar position="top" effect="slide" widgetVar="bar" styleClass="top" >  
    <f:facet name="close">  
            <p:graphicImage value="/resources/image/closebar.png" />  
        </f:facet>  
    <h:outputText value="Parametre Enregistre !" style="color:#FFCC00;font-size:36px;" />  
</p:notificationBar> 

但我从来没有得到它的作品,为什么???

【问题讨论】:

  • 你的图片文件夹中有这张图片吗?
  • 是的。它在另一个页面上显示,但在 notificationBar 的 midel 中没有显示
  • 通知栏现在已修复..我可以关闭它。是否有其他解决方案。不像另一个带有 hide() 方法的按钮
  • 我确信还有其他解决方案。
  • 链接来自 primefaces 网站。当我按下图形图像中的图标关闭栏时,通知栏关闭!我试着这样做,但是....

标签: jsf primefaces


【解决方案1】:

它现在可以工作了,我添加了 2 个脚本 jquery bar.show();setTimeout(bar.hide(),10000)

但是通知栏很快就消失了

 <p:commandButton value="Enregistrer Parametre" action="#{optionBean.updateParametre()}" oncomplete="bar.show();setTimeout(bar.hide(),10000)" update="panel"/>
        <p:notificationBar position="bottom" effect="fade" widgetVar="bar"  > 
        <f:facet name="close">  
                <p:graphicImage value="/resources/image/closebar.png" />  
            </f:facet>  
        <h:outputText value="Parametre Enregistre !" style="color:#FFCC00;font-size:36px;" />  
    </p:notificationBar> 

【讨论】:

  • 这应该可以如你所愿:setTimeout("bar.hide()", 10000); 或 setTimeout("PF('bar').hide()", 10000);。
猜你喜欢
  • 2021-12-18
  • 2015-04-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
  • 2018-04-19
相关资源
最近更新 更多