473,597 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying a scrollable table with fixed head?


I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed independently
which gives a completely ragged look.

Michael

--
Michael Schuerig They tell you that the darkness
mailto:mi*****@ schuerig.de Is a blessing in disguise
http://www.schuerig.de/michael/ --Janis Ian, From Me To You

Jul 24 '05 #1
25 36344


Michael Schuerig wrote:
I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed independently
which gives a completely ragged look.


Mozilla supports
tbody.scrollabl e {
height: 200px;
overflow: auto;
}

<table>
<thead>
<tr>
<th>whatever/th>
</tr>
</thead>

<tbody class="scrollab le">
<!-- rows go here -->
</tbody>
</table>

it then shows scrollbars when needed on the tbody.

On Windows neither Opera 8 nor IE 6 support that however, not sure what
Safari on the Mac or Konqueror on Linux do.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 24 '05 #2
In article <d6**********@n ewsreader3.netc ologne.de>,
Michael Schuerig <mi*****@schuer ig.de> wrote:

I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed independently
which gives a completely ragged look.


Sounds like you are using two separate tables for the header and body.

Use one table, with the header rows enclosed in <thead></thead> and the
body in <tbody></tbody>. Using CSS, apply the styles "overflow:scrol l;"
and "max-height" to the tbody.

May not work in all browsers, but what will?

--
= Eric Bustad, Norwegian bachelor programmer
Jul 24 '05 #3
Eric Kenneth Bustad wrote:
In article <d6**********@n ewsreader3.netc ologne.de>,
Michael Schuerig <mi*****@schuer ig.de> wrote:

I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed
independent ly which gives a completely ragged look.


Sounds like you are using two separate tables for the header and body.

Use one table, with the header rows enclosed in <thead></thead> and
the
body in <tbody></tbody>. Using CSS, apply the styles
"overflow:scrol l;" and "max-height" to the tbody.


Please have a look at <http://www.schuerig.de/michael/layout/list.html>.
I think I'm already doing what you suggest, but it doesn't work
nonetheless. Well, this might be due to the fixed and absolute
positioning, but that's exactly what I'm trying to get.

Michael

--
Michael Schuerig The more it stays the same,
mailto:mi*****@ schuerig.de The less it changes!
http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock

Jul 24 '05 #4
Martin Honnen wrote:


Michael Schuerig wrote:
I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table
where the head row is fixed and the body columns below are scrollable
(with the ordinary scrollbars, no less). Whatever I try, the columns
in the head and the body aren't aligned; the widths are computed
independently which gives a completely ragged look.


Mozilla supports
tbody.scrollabl e {
height: 200px;
overflow: auto;
}

<table>
<thead>
<tr>
<th>whatever/th>
</tr>
</thead>

<tbody class="scrollab le">
<!-- rows go here -->
</tbody>
</table>

it then shows scrollbars when needed on the tbody.


If you don't mind have a look at
<http://www.schuerig.de/michael/layout/list.html>. There I'm not
following your suggestion, but I've tried it without success. I hope
it's obvious what kind of layout I'm trying to achieve -- at least if
you're not using some incarnation of MSIE.

Michael

--
Michael Schuerig There is no matrix,
mailto:mi*****@ schuerig.de only reality.
http://www.schuerig.de/michael/ --Lawrence Fishburn

Jul 24 '05 #5
In article <d6**********@n ewsreader3.netc ologne.de>,
Michael Schuerig <mi*****@schuer ig.de> wrote:
Eric Kenneth Bustad wrote:
In article <d6**********@n ewsreader3.netc ologne.de>,
Michael Schuerig <mi*****@schuer ig.de> wrote:

I'm trying to do something seemingly very simple, but it's brought me
close to crushing my head on the keyboard. All I want is a table where
the head row is fixed and the body columns below are scrollable (with
the ordinary scrollbars, no less). Whatever I try, the columns in the
head and the body aren't aligned; the widths are computed
independentl y which gives a completely ragged look.


Sounds like you are using two separate tables for the header and body.

Use one table, with the header rows enclosed in <thead></thead> and
the
body in <tbody></tbody>. Using CSS, apply the styles
"overflow:scrol l;" and "max-height" to the tbody.


Please have a look at <http://www.schuerig.de/michael/layout/list.html>.
I think I'm already doing what you suggest, but it doesn't work
nonetheless. Well, this might be due to the fixed and absolute
positioning, but that's exactly what I'm trying to get.


I don't know how it might affect things, but I would not be too
surprised if separately positioning the head and body of a table
might confuse things a bit. Why not just set the position of the
table as a whole?

--
= Eric Bustad, Norwegian bachelor programmer
Jul 24 '05 #6
Eric Kenneth Bustad wrote:
In article <d6**********@n ewsreader3.netc ologne.de>,
Michael Schuerig <mi*****@schuer ig.de> wrote:

Please have a look at
<http://www.schuerig.de/michael/layout/list.html>. I think I'm already
doing what you suggest, but it doesn't work nonetheless. Well, this
might be due to the fixed and absolute positioning, but that's exactly
what I'm trying to get.


I don't know how it might affect things, but I would not be too
surprised if separately positioning the head and body of a table
might confuse things a bit. Why not just set the position of the
table as a whole?


Because I can't get the layout I want with that. Now, that doesn't count
for much, I'm more exasperated than experienced with this stuff. I've
tried a whole bunch of permutations of different settings again and I
get all kinds of curious effects, but don't come anywhere close to what
I'd like to have.

If you really think it can be done like you say, please give it a try
and change my code accordingly.

Michael

--
Michael Schuerig Airtight arguments have
mailto:mi*****@ schuerig.de vacuous conclusions.
http://www.schuerig.de/michael/ --A.O. Rorty, Explaining Emotions

Jul 24 '05 #7
Michael Schuerig wrote:
All I want is a table
where the head row is fixed and the body columns below are scrollable


<http://www.schuerig.de/michael/layout/list.html>.


Absolute (and fixed) positioning removes the element from the document
flow. You have in essence disassociated the thead from the tbody, so
their column widths have become independent of each other.

What you want is to get rid of the table element positioning, and set an
explicit height on tbody with overflow:auto.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 24 '05 #8


Michael Schuerig wrote:
Martin Honnen wrote:

Mozilla supports
tbody.scrollabl e {
height: 200px;
overflow: auto;
}

<table>
<thead>
<tr>
<th>whatever/th>
</tr>
</thead>

<tbody class="scrollab le">
<!-- rows go here -->
</tbody>
</table>

it then shows scrollbars when needed on the tbody.

If you don't mind have a look at
<http://www.schuerig.de/michael/layout/list.html>. There I'm not
following your suggestion, but I've tried it without success.


I am sure you get a scrollable tbody if you set a height and overflow as
suggested and the thead lines up with the tbody in Mozilla.
You have a however choosen to combine that suggestion with some weird
fixed and absolute positioning which I don't think makes sense.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 24 '05 #9
kchayka wrote:
Michael Schuerig wrote:
All I want is a table
where the head row is fixed and the body columns below are
scrollable
<http://www.schuerig.de/michael/layout/list.html>.


Absolute (and fixed) positioning removes the element from the document
flow. You have in essence disassociated the thead from the tbody, so
their column widths have become independent of each other.


I agree that that is what has happened. I'm not convinced that this
behavior is good, though. I can't see where it would be useful like
that. When I have a table, to my mind, it is reasonable to expect that
its head and body columns have corresponding widths, no matter where
head and body are positioned. Well, the facts are against me :(
What you want is to get rid of the table element positioning, and set
an explicit height on tbody with overflow:auto.


When you tell me how to do this while anchoring the body of the table to
(a fixed distance from) the bottom edge of the window, then, yes, I
agree.

Michael

--
Michael Schuerig Face reality and stare it down
mailto:mi*****@ schuerig.de --Jethro Tull, Silver River Turning
http://www.schuerig.de/michael/

Jul 24 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2022
by: Leo J. Hart IV | last post by:
Hello, I have a table: <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1"> <tr> <td width="10%">&nbsp;</td> <td width="10%" bgcolor="#C0C0C0">xa</td>
2
3186
by: Mel | last post by:
Scrollable table widget with fixed header is there such thing ? thanks, Mel
6
20543
by: abctech | last post by:
Helo Friends, I am a novice Java programmer, I'm working with Jsp + Javascript to develop a web application.I only have basic Html knowledge and I mostly use "FrontPage" to develop my web pages but currently my webpage requires some dHtml and CSS fundamentals hence I'm posting a query in this forum expecting some guidance, I have a floating table in my webpage which I achieved using JS. I have written Jsp code to get database records one...
2
1620
by: soeter04 | last post by:
Hey guys, I'm trying to make a scrollable table as follows: table is inside a div that is scrollable, both horiz and vert above that div is another div, containing the table headers. As the user scrolls the main div horizontally, the headers should move accordingly. http://www.ruimtemaker.nl/test/index.html It does work as i wanted now, only thing is the alignment of the two table columns. The more columns, the more it's off...
7
6156
by: buntyindia | last post by:
I have the following scrollable table I have to implemet a functionality that I can select a row in it & display that data in popup window.. Any hints/example or similar available implementation? http://img120.imageshack.us/img120/8209/tableyv4.gif http://www.imaputz.com/cssStuff/bigFourVersion.html# Help
3
2357
by: anniejose | last post by:
I am facing an issue in displaying a calendar popup on click of a calendar icon in one of my JSP pages. In my JSP page I have 3 calendar icons in a horizontally scrollable table. If I click the 1st calendar icon, the calendar gets popped up. Then if I click the 2nd calendar icon, the image gets popped up properly. Now I have to scroll to the right to view the 3rd calendar icon. Now when I click the 3rd calendar icon, the calendar image gets...
1
2441
by: Chris Date | last post by:
Hi I´ve got a problem with my scrollable table. It´s a weekscheduler table with 7 columns ( weekdays ) and dynamicaly rows ( time ). So the rows starts at 0:00am and ends at 12:00pm ( 24:00h ). There is a value in the database, with a timeshift value ( in minutes ). For example, timeshift value = 480 (480: 60 = 8) --> set scrollbar to 8:00am. How can i set the scrollbar by pageload to the timeshift value? Here 2 jpgs about the scheduler...
0
7969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8035
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1238
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.