Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Datatable with scrollbar in JSF

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 24575
168
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24575
168
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic