How to refresh the page after closing the p dialog:

I have a dialog below:

<h:form id="r1">
  <p:commandButton value="Basic" type="button" onclick="PF('dlg1').show();" />
  <p:dialog header="Basic Dialog" widgetVar="dlg1">
    <h:outputText id="test" value="Welcome to PrimeFaces" />
  </p:dialog>
</h:form>

      

How do I refresh the JSF page after the dialog is closed?

+3


source to share


1 answer


<p:dialog>

supports ajax event close

. This requires it to be placed inside <h:form>

(as opposed to the general recommendation ), so you need to make sure that it is already manually tied to the very end <h:body>

and that you are not using it appendToBody

.

<h:body>
    <h:panelGroup id="content" layout="block">
        ...
    </h:panelGroup>

    ...

    <h:form>
        <p:dialog>
            <p:ajax event="close" update=":content" />
            ...
        </p:dialog>
    </h:form>
</h:body>

      



Use if necessary update="@all"

if you intend to refresh the entire page . ... But it's best to only update the parts that really need to be updated.

+8


source







All Articles