Primefaces p: dialog not always displayed if update = "dlg" in commandButton

I have a jsf personal 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 dynamic title in the dialog box:

<p:dialog ... header="#{myBean.header}" ...  >  

at what point should I change the attribute updatein p:commandButton:

update="@form :dlgEdit"  

But in this case, the dialog will appear only the first time the button is pressed. He does not appear a second time, and then appears again ...
Why? How can I show dialogue always?

thank

+5
source share
1 answer

Use an attribute oncompleteinstead of an attribute onsuccess.

<p:commandButton ... update="@form :dlgEdit" oncomplete="_dlgEdit.show()" />

onsuccess , ajax- , , ajax ajax. oncomplete , ajax . . <p:commandButton>.

, :

  • onclick
  • ajax process
  • onbegin
  • ajax
  • ajax ( HTTP 200)
  • onsuccess
  • ajax HTML DOM update
  • oncomplete
+11

All Articles