首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rerender of rich:popupPanel

rerender of rich:popupPanel
EN

Stack Overflow用户
提问于 2012-11-29 03:48:01
回答 1查看 3.5K关注 0票数 2

我的工作是:

代码语言:javascript
复制
- RichFaces 4.2.2
- Mojarra 2.1.14

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

代码语言:javascript
复制
<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>

而豆码是:

代码语言:javascript
复制
@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标记中,则该代码将无法工作。这是代码片段:

代码语言:javascript
复制
<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. 我怎么才能让它起作用?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-29 06:23:30

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

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

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13618500

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档