I have a jsf facelet page like this (extremely simplified version):
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 invoked