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

Multiple tables causes issues on table height change #49

Closed lesma closed 8 years ago

lesma commented 9 years ago

If there are multiple tables on a page then on a table height change, either by filtering, changing the number or rows, or loading data via AJAX, then the other tables fixed header can be displayed in an incorrect place.

To reproduce: 1) Go to https://datatables.net/release-datatables/extensions/FixedHeader/examples/two_tables.html 2) On the top table search for AAA (no matching records) 3) The second table’s fixed header is still in the original position, which is now in the middle of the second table

To work around this issue, in the drawCallback function of each of the tables I force an update of all of the fixed headers.

DataTables commented 9 years ago

Thanks for pointing this out. I'm a little swamped at the moment, so can't say when I'll get to it, but I will do as soon as I can.

DataTables commented 8 years ago

It seems to work okay here: http://live.datatables.net/vafagoso/1/edit .

Having said that - if you search in the table table you still need to update the cached positions that the second table has stored - otherwise there will be misalignment.

Possibly FixedHeader should listen for the draw event from all tables on the page, but other elements on the page which are dynamic could also have this issue, so I think for the moment it might be best to simply have the requirement that the update method be called.

Going to close for the moment, but will consider for future enhancement.