aspose file tools*
The moose likes JSF and the fly likes Datatable with scrollbar in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Datatable with scrollbar in JSF" Watch "Datatable with scrollbar in JSF" New topic
Author

Datatable with scrollbar in JSF

selvakumar Thiyagarajan
Greenhorn

Joined: Oct 06, 2008
Posts: 28
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

Joined: Jun 25, 2001
Posts: 16014
    
  20

Core JSF doesn't support scrolling. However many third-party add-ons do. Check out MyFaces Tomahawk or JBoss RichFaces, for example.


Customer surveys are for companies who didn't pay proper attention to begin with.
Christoph Mayr
Greenhorn

Joined: Aug 26, 2009
Posts: 2
I surrounded my dataTable with:

<div style="overflow:auto; width=700px; height=400px;">
<h:dataTable>
.
.
.
</h:dataTable>
</div>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

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

Joined: Oct 06, 2008
Posts: 28
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

Joined: Jul 17, 2009
Posts: 19
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.
 
wood burning stoves
 
subject: Datatable with scrollbar in JSF