Reputation: 299
I use dialog framework of :
http://www.primefaces.org/showcase-labs/ui/dialogFrameworkData.jsf
I create a file view_test.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" >
<h:head>
<title>Dialogo Prueba</title>
</h:head>
<h:body>
<h:form id="idFormTest">
<h:panelGrid id="idPgAdressStore" columns="2" columnClasses="col1,col2">
<h:outputLabel for="idAdress" value="Adress: " />
<p:inputText id="idAdress" label="Adresss" size="40" value="#{storeBean.au.strAdress}"/>
<f:facet name="footer">
<h:panelGrid width="100%" columns="2" style="text-align:center">
<p:commandButton id="idBtSaveDir" value="Save" actionListener="#{storeBean.saveAdress}" />
<p:commandButton id="idBtCancelDir" actionListener="#{storeBean.closeAdress}" value="Cancel"/>
</h:panelGrid>
</f:facet>
</h:panelGrid>
</h:form>
</h:body>
this dialog is open of other form "idFormStore", when I click commandButton "idBtSaveDir" the method saveAdress is called and the value in idAdress is copied in other inputtext in idFormStore
public void saveAdress(ActionEvent event) {
au.setAdressStore(au.getStrAdress());
RequestContext.getCurrentInstance().update("idFormStore");
RequestContext.getCurrentInstance().closeDialog("/pages/logistica/store/view_test");
}
I am updating the form idFormStore, but it doesn't update RequestContext.getCurrentInstance().update("idFormStore") doesn't work,
I also put the panelgrid where is the inputext and doesn't update, RequestContext.getCurrentInstance().update("idFormStore:idPanelStore")
but I reload all the page the value that I enter appear, so What is that I have to put in RequestContext.getCurrentInstance().update?
Upvotes: 4
Views: 11905
Reputation: 2405
Dialog Framework opens the dialog in an iframe. To update values in the parent view add this ajax event to the commandButton or commonadLink that opens the dialog:
<p:commandButton value="Open Dialog" actionListener"...">
<p:ajax event="dialogReturn" update="idFormStore"/>
</p:commandButton>
Upvotes: 6
Reputation: 677
You can put the update in xhmtl:
<p:commandButton id="idBtSaveDir" value="Save" ajax="true" update=":idFormTest" actionListener="#{storeBean.saveAdress}" />
Upvotes: 0