JSF Richfaces PopupPanel 刷新表单不起作用

JSF Richfaces PopupPanel refresh form not working

在以下情况下,rich:popupPanel 上的数据未刷新时出现问题:

  1. 当用户第一次打开弹出面板时,值从 bean 中获取并显示。
  2. 用户更改了一些值,然后决定不保存更改并点击关闭按钮。
  3. 然后他再次打开弹出窗口。当再次打开对话框时,在支持 bean 中,相关值正确地更改回以前的值(调用 load()),但此更新未反映在 UI 中。 用户可以看到他之前选择的值(第 2 步),而不是支持 bean 上的值。

您是否知道任何解决方案,一旦在浏览器中打开它,就可以使用支持 bean 的值强制更新弹出面板的组件? 如果数据显示在单独的页面上,而不是在弹出面板上,我没有这个问题,但我需要根据要求使用弹出面板。

代码如下: 1.打开弹出面板的组件

<a4j:commandLink id="config" value="open" action="#{bean.load()}"
oncomplete="#{rich:component('configPopUp:pp')}.show();" execute="@this">                           
</a4j:commandLink>
  1. 弹出面板

     <rich:popupPanel id="ConfigPopUp"  width="800" height="350" title=" "> 
     <h:form id="ConfigForm">
            <div class="row " style="margin: 0px">
              <div >
                <a4j:commandButton styleClass="pull-right" id="ConfigSave"
                    actionListener="#{bean.saveConfiguration()}"
                    value="#{text['Configuration.save']}" immediate="true">
                </a4j:commandButton>
            </div>
        </div>                      
    
         <ui:repeat
            value="#{bean.selectedValues}"  var="current" varStatus="i">
            <div class="row" style="margin: 0px">
                <div class="col-sm-4 col-sm-offset-1 ">
                    <h:outputText value="#{current.text}" />
                </div>
                <div class="col-sm-4 ">
                    <rich:select value="#{current.relevance}">
                        <f:selectItems
                            value="#{bean.relevanceOptions}"/>
                        <f:ajax event="change" render="@form" execute="@this" />
                    </rich:select>
                </div>                  
            </div>
        </ui:repeat>
    
      </h:form>
      </rich:popupPanel>
    

模式面板不会在 .hide() 上自动重新呈现,因此 "normal" 支持 bean 具有正确的信息但面板没有

您可以通过将 "render" 属性添加到带有面板 ID(或面板的 cointener 元素)的 commandLink 来修复它。

<a4j:commandLink id="config" value="open" action="#{bean.load()}"
   oncomplete="#{rich:component('configPopUp:pp')}.show();" render ="ConfigPopUp" execute="@this">                           
</a4j:commandLink>

另一个解决方案是在popupPanel中使用domElementAttachment = "parent",你可以在rich_modalPanel documentation

上阅读它

希望对您有所帮助