wood burning stoves 2.0*
The moose likes JSF and the fly likes Variable number of columns within dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Variable number of columns within dataTable" Watch "Variable number of columns within dataTable" New topic
Author

Variable number of columns within dataTable

Rory Evans
Greenhorn

Joined: Feb 19, 2010
Posts: 18
Hi,

On my backing bean, I have a list of Player objects. Each Player object has a list of Card objects.

On my jsf page, I want to display a dataTable with one row per Player and one column per Card. Since each player may have a different number of cards, I need to have a way of determining how many columns to create.

My initial idea was to use something like:



but this renders no columns at all (after reading around the subject, I understand why this is the case). Can anyone suggest a suitable alternative or workaround for the problem described above?

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

You're not the first one to discover that the ui:repeat element doesn't work well in tables.

Your best bet, I think, is to bind the table itself to a backing bean and construct the columns in backing bean code. Or you could use the RichFaces DataGrid control.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Variable number of columns within dataTable
 
Similar Threads
Adding Dynamic Datatable to Panel Grid
ui:repeat and POST
Presenting variable number of columns with primefaces datatable
Change CSS from ControllBean
Doubt in JSF