Well as mentioned in the Firefox 4 changelog, there will be no longer support for scrollable <tbody>
's.
There are a bunch of workarounds - javascript or 2 seperate tables - but none of them solves all problems. Javascript is obviously slower (with 600 rows you can forget to try to scroll a table), and 2 tables are gonna be problematic with cell-width.
Do you know if there is some cool way to do this? We are using jsf / facelets and now have to redo the tags, starting with a good idea would be awesome :-)
Try the first method of this page, pure CSS with a single table (2 divs around the table, and the thead is positionned absolute) : tablescroll Seems to work on FF4/IE9/IE8 in addition to IE7/FF3.6.
PrimeFaces and RichFaces have scrollable datatable components which fetches new rows by ajax.
(both JSF component libraries uses jQuery under the covers anyway)
I worked on a frameworkless prototype I want to share with you. It's working in Firefox 4+, IE7-8 (haven't checked 6 or 9) Safari and Chrome.
The biggest unsolved problem is what to do when the static headers run out of room to shrink before the data columns do.
For the actual project I was working on frankly I backed out of the scrolling tbody and went with pagination. but I was dealing with 25+ columns with sorting and potentially 1000s of rows.
Anyway this is where I got to before I abandoned it. Please post your additions if you improve it: Hope this helps.
Link to an example
I know you're trying to avoid js/separate table implementations, but it was the only one I could find that worked across multiple browsers. Try http://www.tablefixedheader.com/. It's a jquery solution and worked, in my limited testing, across IE6 / IE8 / FF3. (Haven't tested FF4).
Thanks to digitaldigs from MozillaZine, I was able to make it work with few modifications. The fix works great for FF4, FF7 and FF11.
I hope this helps! :)
Issues I have fixed- 1. scrollWidth did not work for me so had to go for offsetWidth
Scroll bar width 16 pixel also was not helping so removed it. Instead made my tbody style as-
.scrollContent { overflow-x:hidden; overflow-y:scroll; /* I did this only for Mozilla. IE will show 2 scroll bars if applied*/ display:block; }
With change #2, I had to pad the last cell of the header to accomodate scroll bar.
/* I did this only for Mozilla. Not for IE*/
.fixedHeader tr th:last-child { padding-right: 20px; }
My fixed header table has colspan used a lot hence was not able to set width, so I first look for a correct row with correct number of cells and then I process.
My code looks like below:
Why not use a scrollable div? Maybe one of these two options:
or simpler:
Not pretty I know but hey I'm no Michaelangelo :)