Author Topic: Keeping the table header at the top of the table  (Read 2475 times)

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Keeping the table header at the top of the table
« on: November 19, 2007, 12:31:03 PM »
I'm working on developing a website for projects that should be coming up for bid.  I've been told that once it is up and running there will be a lot of projects listed.  I've already worked on a filtering system so users will initially only see the ones they are interested it (for example a contractor in the LA area probably doesn't give a shit about what is happening up in near the Oregon border).

The probably is there is still the possibility for a lot of projects and there is a lot of columns (personally I'm hoping to find a way to cut down the number of columns).  This means there will be a giant table that will be several screens long.  So I need to find a way to provide the column headers where they can still be seen.

Right now I'm just repeating the headers after 3 rows but I'd like to find a better solution.

If the table header was at the top of the I'd just do some trickery with CSS to keep it there as the page scrolled.  Unfortunately I have a web header above that.  So what I'd like is for the page to scroll down until the table header hit the top of the screen and then "stick" there.  But I don't know of any good way of doing this.

Has anyone else ran into a similar situation?  Any suggestions?

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Keeping the table header at the top of the table
« Reply #1 on: November 19, 2007, 12:54:21 PM »
my first thought (maybe not the best idea)
is to have two tables (you'd have to use fixed widths for the columns)

the first table would have the header row.

the second table would have the data.

put the second table in a <div> and set its height and width w/ CSS.  Also set the css overflow style to scroll.

<div style="width: 100%; height: 350px; overflow: scroll">
 <table>
  all your data
 </table>
</div>
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

Perspective

  • badfish
  • Jackass In Charge
  • Posts: 4635
  • Karma: +64/-22
    • http://jeff.bagu.org
Re: Keeping the table header at the top of the table
« Reply #2 on: November 19, 2007, 01:12:29 PM »
table header in a top frame!!!


;)

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Keeping the table header at the top of the table
« Reply #3 on: November 19, 2007, 02:04:49 PM »
frames are evil.
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Keeping the table header at the top of the table
« Reply #4 on: November 20, 2007, 01:31:57 PM »
Frames suck but may be the simplest solution here.  I was going to suggest Micah's idea as well.  The other suggestion would be to open it in a new window and drop the web header.