Primefaces JSF - <p:commandButton that serves the update and oncomplete

Asked

Viewed 4,580 times

0

I am trying to make an orderList and I am having trouble configuring the attributes in the tag commandButton update and oncomplete. I also don’t know what their function is, but I know it doesn’t work right if not configured right. Anyone would explain it to me? Thanks.

<p:orderList value="#{cliente.listaClientes}" var="cl" controlsLocation="none" itemLabel="#{cl.nome}" itemValue="#{cl}" />
<p:commandButton value="Submit" update="displayListaClientes" oncomplete="PF('clDialog').show()" style="margin-top:5px" />
  • In update you reference the components that must be updated via AJAX and in oncomplete you specify the javascript that must be executed after the AJAX request has been completed.

2 answers

1


Looking at your code I saw that the 'oncomplete' this right, it will perform this function of the primefaces to show your dialog. As for Update it works when you need to update something inside your screen, for example update your 'form' after the click of this button.

<h:form id="form_user">
    <p:commandButton value="Submit" update="form_user" oncomplete="PF('clDialog').show()" style="margin-top:5px" />
</h:form>

0

The update updates the part of the screen in question. The id of the component can be informed, if the same by a container (as a panelGroup) updates all components within the tag in question.

Ex when clicking a button you want it to update only part of the screen instead of the whole screen. No update Voce informs which part or parts of the screen you want to update.

oncomplete already executes something (javascript) when the ajax request is completed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.