Reputation: 1175
I'm working with:
- RichFaces 4.2.2
- Mojarra 2.1.14
Lets look at simple code below:
<h:form>
<h:selectOneRadio value="#{testBean.option}" >
<f:selectItem itemValue="0" itemLabel="Option 0"/>
<f:selectItem itemValue="1" itemLabel="Option 1"/>
<f:ajax execute="@this" render="infoPanelId"/>
</h:selectOneRadio>
<a4j:outputPanel id="infoPanelId">
<h:outputText value="Option 0 selected" rendered="#{testBean.option == '0'}"/>
<h:outputText value="Option 1 selected" rendered="#{testBean.option == '1'}"/>
</a4j:outputPanel>
</h:form>
and the bean code:
@ManagedBean(name="testBean")
@ViewScoped
public class TestBean implements Serializable{
private String option;
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}
It works fine, and it is simple. Rerendering works as expected. But if we place this simple code inside rich:popupPanel tag, that code will not work. This is the code snippet:
<h:form>
<a4j:commandButton
value="show popup"
oncomplete="#{rich:component('testPopup')}.show()"
render="testPopup"
/>
<rich:popupPanel id="testPopup" modal="false" autosized="true" resizable="false">
<f:facet name="header">
<h:outputText value="popup"/>
</f:facet>
<h:panelGrid columns="1">
<h:selectOneRadio value="#{testBean.option}" >
<f:selectItem itemValue="0" itemLabel="Option 0"/>
<f:selectItem itemValue="1" itemLabel="Option 1"/>
<f:ajax execute="@this" render="infoPanelId"/>
</h:selectOneRadio>
<a4j:outputPanel id="infoPanelId">
<h:outputText value="Option 0 selected" rendered="#{testBean.option == '0'}"/>
<h:outputText value="Option 1 selected" rendered="#{testBean.option == '1'}"/>
</a4j:outputPanel>
</h:panelGrid>
</rich:popupPanel>
</h:form>
So the code inside popupPanel does not work. I cannot rerender part of popupPanel. So I have two questions:
Upvotes: 2
Views: 3523
Reputation: 1059
1) Because by default popupPanel
is shown inside the <body>
element
2) Adding domElementAttachment="form"
to the rich:popupPanel
should help
Upvotes: 4