File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 15624
    
  15

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: 15624
    
  15

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Datatable with scrollbar in JSF
 
Similar Threads
Using of nested Datatables
JSF + RichFaces not able to reRender
Input row select on data table does not get called
Setting up a JSF project with data tables
JSF ArralyList rendering to Target page is throwing Class Cast Exception