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

Resize table to be smaller smaller is not working properly with FixedHeader #76

Closed Mactory closed 8 years ago

Mactory commented 8 years ago

When using FixedHeader the extension prevents the table from resizing correctly: As long as the table is not scrolled and therefore FixedHeader is not activated, a table that has 100% width resizes its columns nicely to fit the available width during window resizing. Once FixedHeader is activated, it sets the current column widths as absolute values for the min-width style on the header cells. While this allows for a resizing to larger cells, the 'min-width' style unfortunately prevents the cells from also shrinking back again resulting in an overflow of the available space.

The effect can be seen in this fiddle: http://jsfiddle.net/Nb_Dev/cs63pr16/3/

Try resizing the window when FixedHeaders is not yet activated: The cells shrink back nicely. Then scroll so that the FixedHeader is activated: When you now try to resize to a smaller size, the the table will stay its current size.

DataTables commented 8 years ago

Thanks for the PR - sorry for the delay in replying! I actually committed a similar change just a few days ago (e9e4a93530ac2d7dfda207076765b49aa78dc6a0) although I've got it removing the styles after the element has been removed which I think should be a touch faster.