This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Scrolling an HTML table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Scrolling an HTML table" Watch "Scrolling an HTML table" New topic

Scrolling an HTML table

A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
I am hoping that I have a fairly simple question. What I am trying to do is to create a table that has 7 columns. It starts out that the first column is populated and then once an item is selected from the first row the second row is populated etc etc.
My issue that I haven't been able to resolve is how do i make it so that each of the columns is scrollable independantly. The part that seems to be making it so hard for me is that it depends on the page size which isn't fixed so I want to use percentages for the height. Any suggestions on where I might be able to find an idea for this, either a starting point or some sample code ?
From what I understand frames are an ugly way to go, so I am trying to cobble something together with divs, but I was wondering if there is a better/more efficient way of doing this.

thanks in advance - also let me know if I haven't provided enough information.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Individually scollable columns? Inconceivable!

Seriously, that's not something I've ever seen, and there's certainly no support in HTML or CSS for the likes of that.

You might want to expirement with scrollable divs containing individual single-column tables to emulate something like that, but it sounds rather fragile.

Isn't there a more standard way that you can express your data?

[Asking smart questions] [About Bear] [Books by Bear]
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Unfortunately this is the best manner in which to represent the data. Would it make it more feasible to make one master table and within each of the 7 columns make a table with each of those sub-tables scrollable ?

thanks again for the ideas.
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
I came up with something that sort of gives me the result I want.
I have a table that contains 7 tds. Each td is set to have a width of 14% That keeps the tables the right size
then inside of the td I have:
<div style="height:280px; overflow: scroll; padding: 1px;">
and then inside of that I have the table defined.

This gives me what I want except for 1 issue.

The first is that the height is 280 which does not work with various browser sizes (it would be nice if I could make it work with various browswers)

Any thoughts or suggestions ?

*Edited as I solved the first issue - had to specify a size for each td before I could use overflow:auto and that solved the problem of always having scroll bars.
[ February 28, 2007: Message edited by: A knibbs ]
I agree. Here's the link:
subject: Scrolling an HTML table
It's not a secret anymore!