In my example, the bean paisMB
opens a dialog with a datatable for the user search a object. In the bean portoMB
I have the controller of a crud that uses the object searched in the paisMB
.
The code below works, but it does not update the inputText, the update
of the <p:ajax>
execute before the onsuccess
. How can I update the inputText?
<p:inputText id="pais" label="País" value="#{paisMB.paisSelecionado.nome}" required="true" readonly="true" />
<p:commandButton icon="fa fa-search" actionListener="#{paisMB.openPaisDialog}" >
<p:ajax event="dialogReturn" update="panel"
listener="#{paisMB.onPaisChosenFromDialog}"
onerror="#{portoMB.portoSelecionado.setPais(null)}"
onsuccess="#{portoMB.portoSelecionado.setPais(paisMB.paisSelecionado)}" />
</p:commandButton>