使用PrimeFaces动态生成制表符 [英] Dynamically Generate Tabs with PrimeFaces
问题描述
Hi
我想迭代一个person-object列表,并在每个人的标签中显示数据。我试过了:
Hi I would like to iterate over a list of person-object and show the data in a tab per person. I tried:
<p:tabView>
<ui:repeat ...>
<p:tab title="#{expression}>
</ui:repeat>
</p:tabView>
这不起作用。感谢任何帮助
This is not working. Any help appreciated
Marcel
推荐答案
PrimeFaces 3.x的tabView现在支持动态数量的标签,并增加了自己的迭代功能:
PrimeFaces 3.x's tabView now supports a dynamic number of tabs with the addition of its own iteration feature:
<p:tabView value="#{myBean.tabList}" var="tabItem">
<p:tab title="#{tabItem.tabTitle}">
<h:outputText value="#{tabItem.valueA}"/>
... etc.
</p:tab>
</p:tabView>
不幸的是,仍然无法同时包含固定和动态相同tabView中的选项卡(我想做),甚至动态添加选项卡而不重建视图。幸运的是,使用SessionScoped或CDI ConversationScoped bean(或者可能是JSF ViewScoped bean)时,执行后者并不是什么大问题同样)。
Unfortunately, it's still not possible to include both fixed and dynamic tabs in the same tabView (as I wanted to do), or even dynamically add a tab without rebuilding the view. Fortunately, doing the latter isn't a big deal when using a SessionScoped or CDI ConversationScoped bean (or perhaps a JSF ViewScoped bean as well).
这篇关于使用PrimeFaces动态生成制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!