[Javascript] aligning table columns

Paul Novitski paul at dandemutande.org
Wed Feb 11 11:07:32 CST 2004


Thanks, Tim.

The CliPower table control is neatly written.  Its approach to table 
formatting appears to rest on two foundations:  creating a new table object 
in the document, and setting the columns to pre-determined widths when 
they're created.  I'll have to think about that; my current goal is to let 
the browser figure the column widths based on content as usual, then to use 
those found widths when matching column heads to data columns.

Ordinarily, I prefer to let the browser do as much of the rendering as 
possible, writing code to deal flexibly with found values.  The more 
controlling I am, the more time I have to spend giving and changing 
instructions...  But I'll think about this; perhaps being forced to control 
column widths isn't as onerous as it seems initially.

Whose work is CliPower, yours?  Very nice & clean.

Cheers,
Paul



At 04:43 AM 2/11/2004, you wrote:
><http://www.geocities.com/clipower/>http://www.geocities.com/clipower/ 
>click on 'Table Control'
>
>Tim in Ireland.
>----- Original Message -----
>From: <mailto:paul at dandemutande.org>Paul Novitski
>To: <mailto:javascript at LaTech.edu>[JavaScript List]
>Sent: Wednesday, February 11, 2004 9:51 AM
>Subject: [Javascript] aligning table columns
>Friends,
>By groping in the dark, I've been partially successful at setting the
>column widths of two tables equal to one another.  My goal is to have the
>data rows in a scrolling div (overflow: auto;) beneath stationary column 
>heads.
>Apparently I don't yet understand the differences between the various
>object widths --  obj.offsetWidth, obj.style.width, and
>obj.style.pixelWidth -- because what should have been a simple routine jest
>ain't.
>See the attached demo (for IE, not Netscape).  For each of my nine columns,
>I compare the offsetWidth of the colummn head and the data cell, and set
>the style.pixelWidth of both columns to the greater width.
>However, these two kinds of width are apparently different, as can be seen
>when the alignment routine is run a second time -- the column widths grow,
>therefore a table cell's offsetWidth must be greater than its
>style.pixelWidth.  The difference seems to be 9 pixels, which might? have
>something to do with the 10 pixels of right + left stylesheet padding in
>each of the cells.
>A second problem is that the alignment routine fails if I define the width
>of either table.  I want the data row table to fill the width of its
>containing div, but haven't found a way to set it's width without
>discombobulating the alignment routine.
>My Javascript and DHTML references simply define pixelWidth and offsetWidth
>as being "the width" of an object and don't detail their differences.
>Can anyone help illuminate this dark corner for me?
>Thanks!
>Paul
>
>
>----------
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list