meetselva / fixed-table-rows-cols

Fixed Table Header and Columns
http://meetselva.github.com/fixed-table-rows-cols/
Other
77 stars 42 forks source link

Misaligned col header and table #36

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello,

first of all very nice script. It completely solves my problem of visualizing big tables in limited screen space.

Unfortunately when I run it on my table the column headers are misaligned with the rest (see attached picture). The script (as downloaded from your site) is run on a table created using the Django template tag system. I'll upload both of them to help troubleshooting.

Also I would like to know whether it is possible to specify column alignment (vertical and horizontal) & width only for the first column, letting the others with default settings (for rendering different tables with a variable number of columns).

Cheers! Filippo

Update: I can tell that the problem happens when the headers are cloned. Apparently the cloned ones have a different width from the original, from here the misalignment.

ghost commented 8 years ago

Screenshot:

screenshot 2016-08-20 22 54 07

ghost commented 8 years ago

HTML code:

single2.txt

meetselva commented 8 years ago

Could you please attach the HTML code?

ghost commented 8 years ago

The text file attached above has the html code. I tried to copy paste it in this window without much success.

ghost commented 8 years ago

Sorry I think I closed this by error!

meetselva commented 8 years ago

I need to see the complete HTML table code which is not available in the text file. The text file has the server side code.

ghost commented 8 years ago

ah ok. here it is: Fixed Table Header & Column.txt

ghost commented 8 years ago

update:

adding table{table-layout:fixed;} fixed it!

jxramos commented 7 years ago

I suspect the root cause may be in the line

lc.ft_r.width(lc.tableWidth);

which scales the fixed row to the table's width. And though this resizes the individual th elements it does not do so in relation to the table body. This seems to me to be where the disconnect lies. For some column widths I think they just luckily seem to stretch to the appropriate size, but other's aren't so lucky.

I think the fixed row needs to be corrected for widths just like the set of corrections done for the row heights in the code following //set height of fixed_rc and fixed_c