aspose file tools*
The moose likes JSF and the fly likes JSF datatable doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF datatable doubt" Watch "JSF datatable doubt" New topic
Author

JSF datatable doubt

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
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


Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Jan 13, 2008
Posts: 242
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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Jan 13, 2008
Posts: 242
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
Abhi Sanghvi
Greenhorn

Joined: Mar 19, 2009
Posts: 1
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF datatable doubt