使用 PrimeFaces 动态生成标签 [英] Dynamically Generate Tabs with PrimeFaces

查看:18
本文介绍了使用 PrimeFaces 动态生成标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我想遍历一个人对象列表并在每个人的选项卡中显示数据.我试过了:

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

马塞尔

推荐答案

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆