2014-11-21 135 views
0

我有這個tabView到layoutUnit,我可以添加和刪除標籤dinamically。佈局到選項卡TabView

當我嘗試使用layoutUnit到佈局的佈局我有圖形錯誤。 我必須怎樣才能在佈局中使用佈局? 當我添加一個新選項卡時,我還可以優化tabView更新嗎?

<p:layoutUnit position="center" resizable="true" styleClass="borderlessTopUnit" > 
    <p:tabView id="tabViewExt" activeIndex="#{tabViewManagedBean.activeIndex}" styleClass="borderlessUnit" > 
     <p:ajax event="tabClose" listener="#{tabViewManagedBean.onTabClose}" /> 
     <p:ajax event="tabChange" listener="#{tabViewManagedBean.onTabChange}" /> 

     <c:forEach items="#{tabViewManagedBean.tabs}" var="tab_ext" varStatus="loop_ext" > 
     <p:tab title="#{tab_ext.title}" closable="#{tab_ext.closable}" > 
      <f:subview id="tab_ext_#{loop_ext.index}" > 
       <ui:include src="#{tab_ext.page}" /> 
      </f:subview> 
     </p:tab> 
     </c:forEach>  
    </p:tabView> 
</p:layoutUnit> 

回答

0

佈局單元必須有它自己的形式代替,也避免嘗試更新,因爲 同樣的理由佈局單位,更新它的內容,而不是。你應該在標籤內嵌入標籤。

<p:layout fullPage="true"> 
    <p:layoutUnit position="center"> 
     <h:form> 
      <p:tabView id="tabViewExt" 
         activeIndex="#{tabViewManagedBean.activeIndex}" 
         styleClass="borderlessUnit" > 
       <p:ajax event="tabClose" listener="#{tabViewManagedBean.onTabClose}" /> 
       <p:ajax event="tabChange" listener="#{tabViewManagedBean.onTabChange}" /> 

       <c:forEach items="#{tabViewManagedBean.tabs}" 
          var="tab_ext" varStatus="loop_ext" > 
        <p:tab title="#{tab_ext.title}" closable="#{tab_ext.closable}" > 
         <f:subview id="tab_ext_#{loop_ext.index}" > 
          <ui:include src="#{tab_ext.page}" /> 
         </f:subview> 
        </p:tab> 
       </c:forEach>  
      </p:tabView> 
     </h:form> 
    </p:layoutUnit> 
</p:layout> 
相關問題