Immediate = "true" causes update = "component"

I have a control button (Cancel button) that I want to bypass the check of some components on my page. When I have immediate = "true" set on my command button, the update attribute does not work. By "non-working" I mean that the values โ€‹โ€‹on: centerForm: p_definition do not correspond to reset by what they should be. If I select an item from the drop-down list or enter data in the input text, the information should disappear when you click cancel. Setting immediate = false or removing it completely will reset the fields as expected. Here is the definition of the command element that I'm having problems with.

<p:commandButton value="Cancel" style="float: right;" immediate="true" actionListener="#{manageBomPropHandler.doCancel()}" update=":centerForm:p_definition"/> 

Is this expected behavior from immediate = "true"? If so, how did you get around this for the cancel buttons?

+7
source share
4 answers

"Update" will be called / executed at the stage of updating the model. When you set the โ€œimmediateโ€ attribute to a button command, this phase is ignored. See the image below for more details. Standard Lifecycle executes Update Model Values โ€‹โ€‹phase

  P1: Standard Lifecycle executes Update Model Values phase 

Immediate Lifecycle ignored Update Model Values โ€‹โ€‹phase

  P2: Immediate Lifecycle ignored Update Model Values phase 
+7
source

In my case, to update the fields, I bound p: ajax to the required component. This ensured that the corresponding fields / variable in the bean support is updated as soon as the user makes changes to any of these fields.

Another requirement: refresh the data table after the user clicks the immediate authentication button. For this, I used code like:

 RequestContext.getCurrentInstance().reset("Datatable ID"); 
+1
source
0
source

If this can help, there already exists a solution for clean input fields using:

 <p:commandButton value="Reset Tag" update="panel" process="@this" style="margin-right:20px;" > <p:resetInput target="panel" /> </p:commandButton> 

OR

 <h:commandButton value="Reset p:ajax" style="margin-right:20px;" > <p:ajax update="panel" resetValues="true" /> </h:commandButton> 

Source: http://www.primefaces.org/showcase/ui/misc/resetInput.xhtml

0
source

All Articles