Only Rendered ADF Faces Components Can React To PPR
This question comes regularly at Oracle Support and in the forums.
You want to show (render) and hide an ADF Faces component dynamically on your page, depending on the value of another component.
Suppose f.ex. a Radio Group with 2 buttons "Show" and "Hide'.
Clicking "Show" should display a button; it should disappear when clicking "Hide".
For that, you defined a selectOneRadio that saves the values "show" and "hide" in your backing bean, in an attribute "radioBtnValue":
<af:selectOneRadio label="Show/Hide" id="yourSelectOneRadio"You then defined your button as the following:
value="#{Backing.radioBtnValue}"
autoSubmit="true">
<af:selectItem label="Show" value="show"/>
<af:selectItem label="Hide" value="hide"/>
</af:selectOneRadio>
<af:commandButton text="Button"Because of the partialTriggers property, you are expecting the button to be updated when an event occurs on the selectOneRadio.
rendered="#{Backing.radioBtnValue=='show'}"
partialTriggers="yourSelectOneRadio"/>
The rendered property should then be re-evaluated and set to true when the button "Show" was clicked.
Unfortunately, it doesn't work
You cannot use PPR (Partial Page Rendering)
to directly toggle the "rendered" attribute of a component.
You have to wrap
the component (with the rendered attribute) in a parent component and set the
partialTriggers in its parent.
The reason is that only components that
are rendered can react to PPR.
In the example above, you can create a parent with the partialTriggers property, a panelGroup f.ex.:
<af:panelGroup partialTriggers="yourSelectOneRadio">
<af:commandButton text="Button"
rendered="#{Backing.radioBtnValue=='show'}"/>
</af:panelGroup>
When an event occurs on the selectOneRadio, the parent component will react to PPR.
During the PPR,
the parent component and all its children will be updated.
the rendered property of the button will be evaluated and the button
displayed or hidden accordingly
I added sample 7 to my ADF Sample Applications page.