繁体   English   中英

重新渲染rich:popupPanel的一部分

[英]rerender part of rich:popupPanel

我正在与:

- RichFaces 4.2.2
- Mojarra 2.1.14

让我们看下面的简单代码:

<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>

和bean代码:

@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;
    }
}

它工作正常,而且很简单。 渲染工作正常。 但是,如果我们将这个简单的代码放在rich:popupPanel标记中,那么该代码将无法正常工作。 这是代码片段:

<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>

因此popupPanel中的代码不起作用。 我无法重新渲染popupPanel的一部分。 所以我有两个问题:

  1. 为什么?
  2. 我该如何运作?

1)因为默认情况下popupPanel显示在<body>元素内

2)将domElementAttachment="form"添加到rich:popupPanel应该会有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM