当我在按钮提交时使用primefaces组件对话框:onstart(PF('')。show())oncomplete(PF('')。hide()),隐藏对话框也使得growl失望,growl显示来自托管bean的消息。与http://forum.primefaces.org/viewtopic.php?f=3&t=29036相同的问题 谢谢你的任何想法。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Testing jQuery</title>
<style type="text/css">
div {
width: 400px;
height: 300px;
margin: 20px;
float: left;
}
#one {
background-color: red;
}
#two {
background-color: green;
}
#three {
background-color: blue;
}
#one:hover, #two:hover, #three:hover {
height: 150px;
background-color:rgba(0,0,0,0.4);
transition: height 1000ms, background-color 1000ms;
}
</style>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>
</html>
如何解决此问题?
答案 0 :(得分:1)
试试这个:
我的咆哮:
<p:growl id="messages" showDetail="false" autoUpdate="true" sticky="true" />
我的按钮调用对话框:
<p:commandButton global="false"
icon="#{ico.ico_editar}"
title="#{act.btn_editar}"
update=":#{p:component('dAdmObjetivo')}"
oncomplete="PF('dlgAdmObjetivo').show();"/>
我的对话形式不合适:
<p:dialog id="dAdmObjetivo"
widgetVar="dlgAdmObjetivo"
modal="true"
closeOnEscape="true"
minHeight="300"
hideEffect="fade"
showEffect="fade"
resizable="false"
showHeader="false"
appendTo="@(body)">
<h:form>
<h:panelGrid columns="3" style="float: right;margin: 10px 0px 10px 0">
<p:commandButton value="#{act.btn_guardar}"
actionListener="#{bean.registrarObjetivo()}"
update=":#{p:component('pnlObjetivos')}"
icon="#{ico.ico_guardar}" />
<p:spacer width="5"/>
<p:commandButton value="#{act.btn_cerrar}"
global="false"
icon="#{ico.ico_cerrar}"
onclick="PF('dlgAdmObjetivo').hide();">
</p:commandButton>
</h:panelGrid>
</h:form>
我在bean中的方法:
public void registrarObjetivo() {
/**
* Your code
*/
/**
/**
* Hide dialog
*/
RequestContext context = RequestContext.getCurrentInstance();
context.execute("PF('dlgAdmObjetivo').hide();");
/**
* The growl message
*/
FacesMessage fmsg = new FacesMessage(FacesMessage.SEVERITY_INFO, "El objetivo se registró correctamente", null);
FacesContext.getCurrentInstance().addMessage(null, fmsg);
}