DataTables / FixedHeader

Fix the header, footer, left or right columns of a table in place, to always show them when scrolling
http://www.datatables.net/
Other
75 stars 83 forks source link

FixedHeader+FixedColumn height problem with dynamic content #45

Closed scroach closed 8 years ago

scroach commented 9 years ago

Hi there,

I am currently using DataTables with the FixedHeader plugin on somewhat more complex (regarding dynamic content) tables. My tables have a fixed thead with 3 rows and 3 fixed columns. I stumbled upon a problem where displaying content in table cells would cause the plugin to set the table rows to fixed heights. This is done in the method fnEqualiseHeights.

The first problem with this method is the following line which, as the comment tells, should be a fix for Firefox. The method sets fixed heights on the original rows as well as the FixedColumn rows - which basically works but never allows the rows to shrink anymore after hiding content.

The second problem is that this method never sets the fixed height on the FixedHeader rows.

// For Firefox to work, we need to also set the height of the
// original row, to the value that we read from it! Otherwise there
// is a sub-pixel rounding error
originals.eq( k ).css( 'height', height );

Commenting out this line solved the problem for me as I can't find any difference anyway. If this causes any other problems the header rows should be updated as well or line heights should be returned to initial size in any other way.

I've provided a simple example over at jsfiddle: http://jsfiddle.net/Lqk4yacw/2/ Clicking the Show/Hide buttons points out the problem with never going back to original size.

Best regards

DataTables commented 9 years ago

Hi,

You can see the error in your test case if you comment out that line and add a border to the cells: http://jsfiddle.net/Lqk4yacw/4/ .

Interestingly it doesn't have that issue if you scroll along the x-axis, so there might be an initial state issue and Firefox might have changed things to address the problem. It used to be really apparent if you had lots of rows in the table, but no so much now.

I think I need to investigate a bit more :-)

scroach commented 9 years ago

I still can't see any differences or problems with this one?! Running on Firefox 35.0.1

2015-02-27_16-33-40

Concerning the header problem itself: do u see any better solution on fixing this? I thought about removing the fixed height CSS attribute first before reading the height. This should work in most cases, but what if somebody wants to set a fixed height on some header rows - then this would remove this setting.

DataTables commented 9 years ago

It was right at the bottom for me.

I think if someone wants to set a fixed height on rows then they should do it in CSS and FixedHeader / DataTables shouldn't care about it.

Ideally there should be no need for the Firefox fix, and if they have updated their engine to address that, due to the evergreen nature of Firefox I have no problem just removing that workaround.

I need to spend a bit of time experimenting to convince myself that it can be removed. its been a while since I've worked on that bit of the code :-)

scroach commented 9 years ago

Ok thanks, no problem. :) For the moment I've fixed it in my project anyway.

DataTables commented 8 years ago

FixedHeader no longer supports fixing columns in place (as of v3). Going to close this one for now until such a time that that feature is available again.