Creating TabView tabs dynamically by iterating

UI Components for JSF
Post Reply
shuta
Posts: 15
Joined: 25 Dec 2010, 19:20

13 Jan 2011, 12:42

Something I would really like to see in PrimeFaces is creating tabs dynamically, as with the DataGrid, for example:

Code: Select all

<p:tabView var="tabVar" value="#{controller.tabs}">						
  <p:tab title="#{tabVar.title}">
    <h:outputText value="#{tabVar.text}"/>
    ...						
  </p:tab>
</p:tabView>
Are there any plans for this / may I add a feature request for this item?

Alex
Posts: 256
Joined: 16 Dec 2010, 14:24
Location: Germany

13 Jan 2011, 13:18

this is quite easy with c:foreach

Code: Select all

<p:tabView>
  <c:forEach items="#{controller.tabs}" var="tabVar">
    <p:tab title="#{tabVar.title}">
      ...
    </p:tab>
  </c:forEach>
</p:tabView>
PrimeFaces 3.2
Mojarra 2.0.2
Glassfish 3.0.1

jlferreira
Posts: 43
Joined: 16 Nov 2010, 17:52

13 Jan 2011, 19:24

Could you post your controller class?
I tryed to do the same, but without success. I needed to use jquery, but the system become very slow.
Thank you for help me.
Eclipse Helios.
JSF-2.0 (Mojarra 2.1.0-b11).
GlassFish 3.1.
PrimeFaces 2.2.1
EclipseLink 2.1.x - EclipseLink 2.1.x.
PostgreSQL 9.0

Alex
Posts: 256
Joined: 16 Dec 2010, 14:24
Location: Germany

14 Jan 2011, 09:39

i just took the example from shuta, so i dont have one, but there is nothing complex in it.

it only needs a collection named "tabs" which holds some objects having a "title" attribute (dont forget the getters).
Thats it, there are no other requirements.
PrimeFaces 3.2
Mojarra 2.0.2
Glassfish 3.0.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Jan 2011, 11:51

As a note, ui:repeat doesnt work but c:forEach works. We have plans to add support for ui:repeat in PrimeFaces 3.0.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 43 guests