Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF - scrolling datatable

Tags:

jsf

richfaces

I've used this BalusCs guide to view and paging datatables. It's very nice and useful guide (where would I be without it?), but I have one more question (maybe directly for you, BalusC):

Is there some posibility to scroll datatable horizontally and mainly vertically (without moving a headers)?

Thank you

EMERGENCY SOLUTION (using HTML):

place <h:form> to <div id="scrolltable">

and define scrolltable in css, for example:

#scrolltable{
  width: 920px; height: 300px;
  overflow-y: scroll;
  overflow-x: auto;
}
like image 780
gaffcz Avatar asked Mar 14 '26 02:03

gaffcz


1 Answers

This is not directly possible in HTML and therefore also not with the standard set of JSF components. You would need to bring in a lot of specific CSS/JS works. That's too much of detail and pain to summarize in a single answer.

However, there exist 3rd party JSF component libraries which offers that in a single ready-to-use component. For example PrimeFaces and RichFaces 4.x (and RichFaces 3.x) have scrollable datatable components which are even able to fetch new rows by ajax. Since you tagged the question with richfaces, you should be able to use the RichFaces' one.

like image 85
BalusC Avatar answered Mar 16 '26 20:03

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!