Primefaces p:dialog doesn't always show up if update=“dlg” in commandButton

前端 未结 1 1857
醉梦人生
醉梦人生 2021-01-13 02:23

I have a jsf facelet page like this (extremely simplified version):

    
        

        
相关标签:
1条回答
  • 2021-01-13 03:15

    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 invoked
    • ajax request is prepared with form data based on process
    • onbegin handler is invoked
    • ajax request is sent
    • ajax response is successfully retrieved (HTTP status code is 200)
    • onsuccess handler is invoked
    • ajax updates are performed in HTML DOM based on update
    • oncomplete handler is invoked
    0 讨论(0)
提交回复
热议问题