• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF datatable doubt

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic