Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datatable with scrollbar in JSF

 
selvakumar Thiyagarajan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have created a datatable in JSF. How to insert a scrollbar on the datatable? Please advice on this. Thanks in advance!!! :

JSP code:


TableBean.java
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Core JSF doesn't support scrolling. However many third-party add-ons do. Check out MyFaces Tomahawk or JBoss RichFaces, for example.
 
Christoph Mayr
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I surrounded my dataTable with:

<div style="overflow:auto; width=700px; height=400px;">
<h:dataTable>
.
.
.
</h:dataTable>
</div>
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought you meant record scrolling for large output data sets! Didn't realize you were looking to scroll the table rows themselves up and down.
 
selvakumar Thiyagarajan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christoph ,
First of all thanks for the idea. If i use the <DIV> tag, the entire page is getting scrolled. I need the table alone to be scrolled dynamically. For example, scroll bar should be there only if the table exceeds 5 rows. I guess this can be done by javascript. Also do we have Height property for the Datatable.?

Please advice on this.
 
Annu Vinayak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use:

<div style="overflow: auto; border: 1px solid #ccc; height: 260px">

just around your <rich:dataTable> tag. This would do jsut what you want.

P.S. Replace the height parameter with the desired height of your data table.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic