2012-09-21 78 views
1

當我打開我的彈出窗口,我更改選定的選項卡,如果我關閉此彈出並再次打開選定的選項卡作爲相同。如何在彈出菜單中選擇重置標籤?

當此彈出窗口打開時,該如何重置?

哪個避免在第二個屏幕截圖雙電梯的最佳解決方案?

視圖代碼:

 <p:dialog id="dialog" rendered="true" 
      header="#{gestSoftware.action} Configuration des produits" 
      widgetVar="confProd" resizable="false" showEffect="clip" 
      hideEffect="fold"> 

      <h:panelGrid id="display" columns="2" cellpadding="4"> 



       <p:layout style="min-width:900px;min-height:600px;" id="layout"> 

        <p:layoutUnit position="north" style="text-align:center;"> 

         <p:panelGrid> 
          <p:row> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Reference"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Indice Majeur"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Indice Mineur"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center" colspan="2"><h:outputText value="Modele"/></p:column> 
          </p:row> 
          <p:row> 

           <p:column> 
            <p:inputText 
             value="#{gestConfigurationProductBean.referenceConfProduct}" /> 
           </p:column> 

           <p:column> 
            <p:inputText 
             value="#{gestConfigurationProductBean.majorIndexConfProduct}" /> 
           </p:column> 
           <p:column> 
            <p:inputText 
             value="#{gestConfigurationProductBean.minorIndexConfProduct}" /> 
           </p:column> 
           <p:column colspan="2"> 
            <p:selectOneMenu 
             value="#{gestConfigurationProductBean.selectedProductConfModel}"> 

             <f:selectItems 
              value="#{gestConfigurationProductBean.productConfModelList}" 
              var="productConf" itemLabel="#{productConf.reference}" 
              itemValue="#{productConf}" /> 
             <f:converter converterId="productConfModelConverter" /> 
            </p:selectOneMenu> 
           </p:column> 

          </p:row> 

          <p:row> 

           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Identifiable"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Etat"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Famille"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Alimentation"/></p:column> 
           <p:column styleClass="ui-widget-header" 
            style="text-align:center"><h:outputText value="Fiche Suiveuse"/></p:column> 
          </p:row> 

          <p:row> 


           <p:column> 
            <p:selectBooleanCheckbox 
             value="#{gestConfigurationProductBean.identifiableConfProduct}" /> 
           </p:column> 

           <p:column> 
            <p:selectOneMenu 
             value="#{gestConfigurationProductBean.stateConfProduct}"> 
             <f:selectItem itemLabel="actif" itemValue="1" /> 
             <f:selectItem itemLabel="inactif" itemValue="0" /> 

            </p:selectOneMenu> 
           </p:column> 
           <p:column> 
            <p:selectOneMenu 
             value="#{gestConfigurationProductBean.selectedProductFamily}"> 

             <f:selectItems 
              value="#{gestConfigurationProductBean.productFamilyList}" 
              var="productFam" itemLabel="#{productFam.name}" 
              itemValue="#{productFam}" /> 
             <f:converter 
              converterId="configurationProductFamilyConverter" /> 
            </p:selectOneMenu> 
           </p:column> 
           <p:column> 
            <p:selectOneMenu 
             value="#{gestConfigurationProductBean.selectedProductSupply}"> 
             <f:selectItem itemLabel="" itemValue="" /> 
             <f:selectItems 
              value="#{gestConfigurationProductBean.productSupplyList}" 
              var="productSupply" itemLabel="#{productSupply.name}" 
              itemValue="#{productSupply}" /> 
             <f:converter converterId="productSupplyConverter" /> 
            </p:selectOneMenu> 
           </p:column> 

           <p:column> 
            <p:selectOneMenu 
             value="#{gestConfigurationProductBean.selectedFollowingFormModel}"> 
             <f:selectItem itemLabel="" itemValue="" /> 
             <f:selectItems 
              value="#{gestConfigurationProductBean.followingFormModelList}" 
              var="follFormModel" itemLabel="#{follFormModel.name}" 
              itemValue="#{follFormModel}" /> 
             <f:converter converterId="followingFormModelConverter" /> 
            </p:selectOneMenu> 
           </p:column> 

          </p:row> 
         </p:panelGrid> 

        </p:layoutUnit> 

        <p:layoutUnit position="center" size="200px"> 
         <p:tabView id="tabViewElement" dynamic="true" activeIndex="0"> 
          <p:ajax event="tabChange" 
           Listener="#{gestConfigurationProductBean.onTabChange}" 
           update="tabViewElement" /> 

          <p:tab id="idTabElementView" title="Elements Sectionnes"> 

           <p:scrollPanel style="width:100%;height:100%"> 
            <p:dataTable id="productConfs" var="productConf" 
             value="#{gestConfigurationProductBean.productConfsList}" 
             rowKey="#{productConf.idProductConf}"> 

             <f:facet name="header"> 
              <h:outputText value="ELEMENTS" /> 
             </f:facet> 

             <p:column headerText="Reference"> 
              <h:outputText value="#{productConf.reference}" /> 
             </p:column> 

             <p:column headerText="Indice majeur"> 
              <h:outputText value="#{productConf.majorIndex}" /> 
             </p:column> 

             <p:column headerText="Indice majeur"> 
              <h:outputText value="#{productConf.minorIndex}" /> 
             </p:column> 

             <p:column headerText="Designation"> 
              <h:outputText 
               value="#{productConf.productConfModel.reference}" /> 
             </p:column> 


             <p:column headerText="Identifiable"> 
              <p:selectBooleanCheckbox disabled="true" 
               value="#{productConf.identifiable}" /> 
             </p:column> 


            </p:dataTable> 
           </p:scrollPanel> 
          </p:tab> 

          <p:tab id="tabSelectedElement" style="padding:none" 
           title="Choisir Elements"> 
           <p:scrollPanel style="width:100%;height:100%"> 
            <p:dataTable id="cardsElements" var="cardElement" 
             value="#{gestConfigurationProductBean.cardElementList}" 
             rowKey="#{cardElement.idProductConf}" 
             selection="#{gestConfigurationProductBean.selectedElement}" 
             selectionMode="single"> 

             <f:facet name="header"> 
              <h:outputText value="ELEMENTS" /> 
             </f:facet> 

             <p:column headerText="Selection"> 
              <p:selectBooleanCheckbox 
               value="#{cardElement.selectedElement}"> 
               <p:ajax 
                listener="#{gestConfigurationProductBean.checkBoxElement}" /> 
              </p:selectBooleanCheckbox> 
             </p:column> 

             <p:column headerText="Reference"> 
              <h:outputText value="#{cardElement.reference}" /> 
             </p:column> 

             <p:column headerText="Indice majeur"> 
              <h:outputText value="#{cardElement.majorIndex}" /> 
             </p:column> 

             <p:column headerText="Indice majeur"> 
              <h:outputText value="#{cardElement.minorIndex}" /> 
             </p:column> 

             <p:column headerText="Designation"> 
              <h:outputText 
               value="#{cardElement.productConfModel.reference}" /> 
             </p:column> 


             <p:column headerText="Identifiable"> 
              <p:selectBooleanCheckbox disabled="true" 
               value="#{cardElement.identifiable}" /> 
             </p:column> 
            </p:dataTable> 
           </p:scrollPanel> 
          </p:tab> 
         </p:tabView> 
        </p:layoutUnit> 

        <p:layoutUnit position="south" style="margin-top:10px;"> 
         <p:tabView id="softwareTabView"> 
          <p:ajax event="tabChange" 
           Listener="#{gestConfigurationProductBean.onTabChange}" 
           update="softwareTabView" /> 
          <p:tab id="idSoftwareView" title="Logiciels selectionnes"> 
           <p:scrollPanel style="width:100%;height:100%"> 
            <p:dataTable id="softwares" var="software" 
             value="#{gestConfigurationProductBean.softwareList}" 
             rowKey="#{software.idSoftware}"> 

             <f:facet name="header"> 
              <h:outputText value="LOGICIELS" /> 
             </f:facet> 

             <p:column headerText="Nom"> 
              <h:outputText value="#{software.name}" /> 
             </p:column> 

             <p:column headerText="Version"> 
              <h:outputText value="#{software.version}" /> 
             </p:column> 

            </p:dataTable> 
           </p:scrollPanel> 
          </p:tab> 

          <p:tab id="idSelectedSoftwareView" title="Choisir Logiciels" 
           height="100%"> 
           <p:scrollPanel style="width:100%;height:100%"> 
            <p:dataTable id="softwaresSelected" var="softwareSelected" 
             value="#{gestConfigurationProductBean.softwareElementList}" 
             rowKey="#{softwareSelected.idSoftware}"> 

             <f:facet name="header"> 
              <h:outputText value="LOGICIELS" /> 
             </f:facet> 

             <p:column headerText="Selection"> 
              <p:selectBooleanCheckbox 
               value="#{softwareSelected.selectedSoftware}"> 
               <p:ajax 
                listener="#{gestConfigurationProductBean.checkBoxSoftware}" /> 
              </p:selectBooleanCheckbox> 
             </p:column> 
             <p:column headerText="Nom"> 
              <h:outputText value="#{softwareSelected.name}" /> 
             </p:column> 

             <p:column headerText="Version"> 
              <h:outputText value="#{softwareSelected.version}" /> 
             </p:column> 
            </p:dataTable> 
           </p:scrollPanel> 
          </p:tab> 
         </p:tabView> 
        </p:layoutUnit> 
       </p:layout> 
      </h:panelGrid> 
      <h:panelGrid columns="2"> 
       <p:commandButton value="Editer" 
        actionListener="#{gestConfigurationProductBean.buttonForm}" 
        update="message,productConfModels" /> 

       <p:commandButton value="Annuler" 
        actionListener="#{gestConfigurationProductBean.quit}" /> 
      </h:panelGrid> 
     </p:dialog> 

enter image description here enter image description here

謝謝!

回答

2

要確保打開對話框時選擇了選項卡,可以使用對話框的onShow屬性。

<p:dialog onShow="tabview.select(1)"> 
    <p:tabView widgetVar="tabview"> 
     <p:tab> 
      This is tab 1 
     </p:tab> 
     <p:tab> 
      This is tab 2 
     </p:tab> 
    </p:tabView> 
</p:dialog> 
+0

我得到了同樣的問題,因爲對話框出現後1秒切換開關。 對話框已經變形。 –

+0

你可以嘗試'onHide'而不是'onShow'。隱藏對話框時執行'onHide'。 – siebz0r

+0

工作!謝謝你,先生 –

相關問題