2015-12-15 56 views
1

我有一個帶有兩個selectOneMenus的豐富popupPanel,它在使用彈出窗口時呈現更多組件。主要的問題是在組件渲染時,彈出式面板不會自動調整大小。當我更新到richfaces 4.3.7時出現了這個問題,但是這個版本解決了我的另一個問題,所以我不想回到以前的版本。Richfaces彈出式面板在其內容動態更新時未獲得自動化

<rich:popupPanel id="editAccessPopup" modal="true" autosized="true" domElementAttachment="parent"> 
      <f:facet name="controls"> 
       <h:outputLink value="#" 
        onclick="#{rich:component('editAccessPopup')}.hide(); return false;"> X </h:outputLink> 
      </f:facet> 
      <h:form id="edit_access_popup_form"> 
       <a4j:outputPanel id="outputPanel" layout="block"> 
        <legend style="font-weight: bold;">Edit Access</legend> 
        <rich:panel> 
         <h:panelGrid columns="2" style="width:100%" 
          columnClasses="panelgrid_label_column, panelgrid_input_column"> 
          <h:outputLabel style="font-weight: bold; align:left;" 
           value="Type" 
           for="edit_access_access_type_menu" /> 
          <h:selectOneMenu id="edit_access_access_type_menu" 
           value="#{serviceDesignBean.accessTypeSelectData.selectedIndex}" 
           valueChangeListener="#{serviceDesignBean.valueChangedForAccessType}" > 
           <f:selectItem itemValue="" 
            itemLabel="#{lbl.default_selectitem_value}" /> 
           <f:selectItems 
            value="#{serviceDesignBean.accessTypeSelectData.list}" 
            var="accessType" itemValue="#{accessType.value}" 
            itemLabel="#{accessType.label}" /> 
           <a4j:ajax event="valueChange" 
            render="service_id_panel, edit_access_popup_form" 
            execute="@this" /> 
          </h:selectOneMenu> 

          <h:outputLabel style="font-weight: bold; align:left;" 
           value="#{lbl.edit_access_popup_service_action}" 
           for="edit_access_service_action_menu" /> 
          <h:selectOneMenu id="edit_access_service_action_menu" 
           value="#{serviceDesignBean.accessActionSelectData.selectedIndex}" 
           valueChangeListener="#{serviceDesignBean.valueChangedForAccessAction}"> 
           <f:selectItem itemValue="" 
            itemLabel="#{lbl.default_selectitem_value}" /> 
           <f:selectItems 
            value="#{serviceDesignBean.accessActionSelectData.list}" 
            var="accessAction" itemValue="#{accessAction.value}" 
            itemLabel="#{accessAction.label}" /> 
           <a4j:ajax event="valueChange" 
            render="service_id_panel, edit_access_popup_form" 
            execute="@this" /> 
          </h:selectOneMenu> 

          <h:outputLabel value="Service Id" for="input_service_id" 
           style="font-weight: bold; align:left;" /> 
          <a4j:outputPanel id="service_id_panel" layout="block"> 
           <h:inputText id="input_service_id" 
            value="#{serviceDesignBean.inputServiceId}" 
            disabled="#{not serviceDesignBean.serviceIdFlag}" /> 
          </a4j:outputPanel> 

         </h:panelGrid> 
        </rich:panel> 
       </a4j:outputPanel> 

       <h:panelGroup id="access_attr_panel" 
        style="margin-left:20px;margin-top:20px;" 
        rendered="#{not empty serviceDesignBean.accessActionSelectData.selectedIndex and not empty serviceDesignBean.accessTypeSelectData.selectedIndex}"> 
        <fieldset> 
         <legend>#{lbl.sol_manag_service_Attributes}</legend> 
         <h:panelGrid style="margin-left:20px;" class="gridStyle" 
          columnClasses="panelgrid_label_column,panelgrid_imput_column" 
          columns="2"> 
          <h:outputText value="#{lbl.ServiceAttributeName_SPEED}" 
           rendered="#{serviceDesignBean.serviceAttrVisibility.visibilityToSpeed}" /> 
          <a4j:outputPanel layout="block" 
           rendered="#{serviceDesignBean.serviceAttrVisibility.visibilityToSpeed}"> 
           <h:selectOneMenu 
            disabled="#{not serviceDesignBean.serviceAttrVisibility.editableSpeed}" 
            value="#{serviceDesignBean.selectedSpeed}"> 
            <f:selectItem itemValue="" 
             itemLabel="#{lbl.default_selectitem_value}" /> 
            <f:selectItems value="#{serviceDesignBean.accessSpeedList}" 
             var="speed" itemValue="#{speed.speedValue}" 
             itemLabel="#{speed.speedValue}" /> 
            <a4j:ajax event="valueChange" execute="@this" /> 
           </h:selectOneMenu> 
          </a4j:outputPanel> 

...more components to get rendered... 

      <a4j:commandButton id="save_access_btn" 
        value="#{lbl.service_design_save_edited_access}" 
        onclick="#{rich:component('editAccessPopup')}.hide()" 
        actionListener="#{serviceDesignBean.saveEditedAccess}" 
        render=":pending_services, :accesses_form" 
        oncomplete="javascript:location.reload(true)"></a4j:commandButton> 

      </h:form> 
     </rich:popupPanel> 

我已經在這裏找到:https://developer.jboss.org/thread/241593,我可以用這個panel.doResizeOrMove(RichFaces.ui.PopupPanel.Sizer.Diff.EMPTY);強制彈出窗口調整大小。我有兩個問題:

  1. 你能告訴我如何調整彈出窗口的上述功能?
  2. 有沒有解決我的問題的另一種方法?

提前致謝!

回答

1

你只需調用該方法,同樣的方式你這樣做關閉面板:

#{rich:component('editAccessPopup')}.doResizeOrMove(RichFaces.ui.PopupPanel.Sizer.Diff.EMPTY); 

至於其他的選項,你可以重新呈現整個面板。將oncomplete="#{rich:component('editAccessPopup')}.show();添加到commandbutton以再次顯示面板。

+0

它就像一個魅力!謝謝! – christinasantz