Win a copy of Programmers Guide to Apache Thrift this week in the Open Source 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JSF datatable doubt  RSS feed

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table which prints the columns as below:



The out put is as follows. And the list grows.
____________________________________
First Name Last Name Username
Beema Sena beeemas
.
.
.
_____________________________________

How to change the display so that rows become columns and columns become rows as below.

First Name Beema ....
Last Name Sena ....
Username beemas ...

Thanks and Regards


 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rendering in horizontal direction is not possible with h:dataTable. It is also not very good for user experience as horizontal scrolling is very annoying for most of the users.

Either change the datamodel, or write a custom component/renderer, or use t:dataList and a shot of plain vanilla HTML to achieve your needs.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:Rendering in horizontal direction is not possible with h:dataTable. It is also not very good for user experience as horizontal scrolling is very annoying for most of the users.

Either change the datamodel, or write a custom component/renderer, or use t:dataList and a shot of plain vanilla HTML to achieve your needs.



Thanks Bauke for your explanations. As I have some 30 columns in my database, it will not be nice for a uer to scroll horizontally to view the data. Basically I am displaying one record from a database table.

I tried using but doesn't help me and I don't know how to change the display using t:dataList and a shot of plain vanilla HTML to achieve. Can you please give me a small example?

How about using sakai2.1? I read about it some where while googling. Please suggest something. Thanks.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gopu Akraju wrote:Basically I am displaying one record from a database table.


Only one record at a time? Why did you put it in a List/DataModel and were you trying the datatable? You could just use plain vanilla panelGrid for this.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bauke. Yes most of the time, there is only one record, but it might be more than 1 also as I need to handle that situation also.
Regards
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if you got your answer, but for other's reference i am posting here.

Whatever Bauke said is correct.
The best way to write a Custom Component, or alternatively you can write your own renderer for DataTable.

An another work around is to use a java script function and call it onload.
you can simple print the data table vertically and traverse the HTML table element using Java script and convert rows into columns.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!