Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF (Richfaces) DataTable Column Layout  RSS feed

 
J Ruing
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am relatively new to JSF so forgive me if this is a bit of a silly question. Our product allows clients to dynaimically select what fields they which to view on a html page. I am looking to move this to JSF.

At the moment I can display a single list (2 columns - label name & value) in a single table. I iterate over a list of field elements and thats fine. What I cannot figure out is how to display this in 4 columns label name, value, label name, value this would look much nicer to the user and would be a much better use of the available space on screen.

Any suggestions much obliged.
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the stock JSF table tags don't support dynamic column definitions. What you'd have to do is bind the table to backing bean code and have the backing bean set up the column definitions according to the selected preferences.

Key things to keep in mind are that the column headings are usually defined in facets, but their programmatic equivalents may require direct property setting on the column objects. Also, of course, the appearance in any JSF is primarily controlled by CSS styles, so any tweaking of the appearance would be done via the row and column object's style and styleClass properties.
 
J Ruing
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was coming to this conclusion see code below - have to say not very happy about it ;



employeeBean.columns in my place is just four instances in a list of type Column (taken from rich faces sample project)
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that's not totally unreasonable, but the main issue is that it doesn't lend itself to having a variable number of columns.

Although I prefer to do my view definitions in the view itself using tags, sometimes you need some extra help from the backend.
 
pradip p sardar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using rich faces 3.1 where i dont have option for rich : columns.... i have the simillar requirement....can you please help me for printing the column value using t: column....thanks...

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!