I have a jsf facelet page like this (extremely simplified version):
<h:form id="frmAnagPersonName">
<p:commandButton value="Edit" icon="ui-icon-gear"
update="@form :frmEdit"
onsuccess="_dlgEdit.show()"/>
...
<p:dataTable etc...
...
</h:form>
<p:dialog id="dlgEdit" widgetVar="_dlgEdit" dynamic="true" modal="true" closable="true"
header="Person Identity">
<h:form id="frmEdit" >
<p:panelGrid id="pnlEdit" columns="2">
<p:outputLabel id="lblName" for="eName" value="Name"/>
<p:inputText id="eName" value="#myBean.personName}"
</p:panelGrid>
</h:form>
</p:dialog>
It works fine, until I put a dynamyc Header in the dialog:
<p:dialog ... header="#{myBean.header}" ... >
at which point i have to change the update
attribute in the p:commandButton
:
update="@form :dlgEdit"
But in this case the dialog will show up only at the first click on the button. It won't show up the second time, then again show up...
Why? How can I have the dialog show up always?
Thank you
Use the oncomplete
attribute instead of onsuccess
attribute.
<p:commandButton ... update="@form :dlgEdit" oncomplete="_dlgEdit.show()" />
The onsuccess
attribute is invoked directly when ajax response is successfully arrived but long before the ajax updates are performed based on the ajax response. The oncomplete
attribute is invoked when the ajax updates are successfully completed. See also the tag documentation of <p:commandButton>
.
Basically, this is the event invocation order:
onclick
handler is invokedprocess
onbegin
handler is invokedonsuccess
handler is invokedupdate
oncomplete
handler is invokedIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With