I just have a selectOneRadio and want to display (or not) a panel depending on the boolean value (basic reRender after an event with a4j).
My binding with the boolean is good, and the action confirms that the boolean value changes on clicking:
Here is my selectOneRadio :
<h:selectOneRadio value="#{myController.myBoolean}">
<a4j:support event="onclick" action="#{...}" reRender="myPanel" />
<f:selectItem itemLabel="Yes" itemValue="#{true}"/>
<f:selectItem itemLabel="No" itemValue="#{false}"/>
</h:selectOneRadio>
Why is the reRender not working after using the rendered attribute (no effect) :
<a4j:outputPanel id="myPanel" rendered="#{myController.myBoolean}">...
whereas it works using style attribute, by changing the visibility :
<a4j:outputPanel id="myPanel" style="#{myController.myBoolean ? 'visibility:visible;':'display:none;'}">...
- Richfaces 3.3.3.Final
- Same bug on every browsers
The problem can be explained as below.
Initially your panel “myPanel” is not rendered because rendered attribute is set to
false. Then now you change the rendered value totrueby selecting theselectOneRadiocomponent. Then you are going toreRenderthe “myPanel” by usingreRender="myPanel"in youra4j:supporttag.But unfortunately there is no “myPanel” to be reRendered because there is no such element in your page(because it is not rendered).
You can overcome this issue by reRendering the parent of the “myPanel”. For an example if “myPanel” has a parent
panelas below,Now
reRenderthe parent as belowNote: When you change the
visibilityinstead ofrenderedattribute, it works because although “myPanel” is hidden it is still available in your page.