Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Iterating component that acts like panelGrid

 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a list of items I want to iterate over, and display in a panel grid format - ie specify a number of columns, and then the component just adds table cells, wrapping around to the next row when it reaches the column count - just as the PanelGrid does.
ie specifying 3 columns, with 5 items in the list would give something like this:

-------------------------
| item1 | item2 | item3 |
-------------------------
| item4 | item5 | |
-------------------------

The only method of iterating over a list in JSF seems to be the DataTable component. However it assumes a one record per row format. It won't do the format I want.
PanelGrid which DOES do that format doesn't seem to provide any way of iterating over a list/datasource.

I can get the layout I want with a simple JSTL <c:forEach> tag (or any other non-faces iteration), and manually generating table tags, but then I can't use any faces tags within it. (urls/buttons etc)

I know JSP/JSTL/Struts well enough, and have got my head around the basics of JSF, but this seemingly simple requirement doesn't have an obvious solution to me.
Is there a way of doing this with JSF?

Cheers,
evnafets
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic