【问题标题】:Layout into Tab of TabView布局到 TabView 的选项卡中
【发布时间】:2015-01-19 13:14:14
【问题描述】:

我将这个 tabView 放到一个 layoutUnit 中,我可以在其中动态地添加和删除选项卡。

当我尝试在选项卡中使用带有 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>  

【问题讨论】:

    标签: layout primefaces tabview


    【解决方案1】:

    一个布局单元必须有它自己的表单,同时避免尝试更新布局单元,因为 同样的原因,改为更新它的内容。您应该在标签内嵌套标签。

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-28
      • 2018-08-20
      • 2016-06-12
      • 2015-11-28
      • 2012-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多