I'm facing some problems with dialog hiding since than I updated from 3.0.M3 to RC1 and later (I'm using 3.0.Final now).
Initially, I was using oncomplete to hide the dialog, just like a friend of mine registered in this topic (viewtopic.php?f=3&t=17143&p=52276&hilit ... ide#p52276).
Following one of the suggestions, I changed my code to use de visible attribute of the p:dialog. It didn't solve my issue cause the dlg_modal div that applies the overlay to the page is still in there even after the visible attribute had been set to false.
Code: Select all
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta charset="utf-8" />
<title><h:outputText value="teste" /></title>
<link href="http://fonts.googleapis.com/css?family=Cuprum"
rel="stylesheet" type="text/css" />
<h:outputScript library="primefaces" name="jquery/jquery.js" />
</h:head>
<h:body>
<p:outputPanel id="teste_main">
<p:outputPanel id="pnlNotDlg" rendered="#{not testeBean.pnlDlg}">
<h:form id="formButton">
<p:commandButton value="troca" action="#{testeBean.troca()}"
immediate="true" update=":teste_main" />
</h:form>
</p:outputPanel>
<p:outputPanel id="pnlDlg" rendered="#{testeBean.pnlDlg}">
<h:form id="formButtonDlg">
<p:commandButton value="abrir" action="#{testeBean.abrir()}"
immediate="true" update=":teste_main" />
</h:form>
<p:dialog id="dlg" widgetVar="dlg" resizable="false" modal="true"
header="teste" width="300" minWidth="300"
visible="#{testeBean.dlgVisible}">
<h:form id="formDlg">
<p:inputText id="nome" value="#{testeBean.nome}" />
<p:commandButton type="submit" process="formDlg"
update=":teste_main" value="submit"
action="#{testeBean.processar()}" />
<p:commandLink process="@this" immediate="true"
update=":teste_main" value="cancelar"
action="#{testeBean.cancelar()}" />
</h:form>
</p:dialog>
</p:outputPanel>
</p:outputPanel>
</h:body>
</html>
Code: Select all
import java.io.Serializable;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;
@Named("testeBean")
@ViewScoped
public class TesteBean implements Serializable {
private static final long serialVersionUID = 1L;
private String nome;
private Boolean dlgVisible = false;
private Boolean pnlDlg = false;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Boolean getDlgVisible() {
return dlgVisible;
}
public void setDlgVisible(Boolean dlgVisible) {
this.dlgVisible = dlgVisible;
}
public Boolean getPnlDlg() {
return pnlDlg;
}
public void setPnlDlg(Boolean pnlDlg) {
this.pnlDlg = pnlDlg;
}
public void abrir() {
dlgVisible = true;
}
public void processar() {
System.out.println(nome);
dlgVisible = false;
pnlDlg = false;
}
public void cancelar() {
dlgVisible = false;
}
public void troca() {
pnlDlg = true;
}
}
Camilo