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

Not reducing column width on redraw #48

Closed lesma closed 8 years ago

lesma commented 9 years ago

With the alwaysCloneTop being true, I have found that if the data in the cells is dynamic in length then the columns are resized to be bigger to accommodate large strings but when the large strings are removed and a redraw triggered (by changing to a different page/filtering/adjusting page length) the columns were are reduced in width. I seem to have got round this this by removing the $(this).width( a[i] ); and $(this).width( b[i] ); lines in the fixedHeader.js which set the column width of the original table but suspect that this may break something else.

See https://jsfiddle.net/uahoohLs/ for an example 1) Set to show 100 entries (columns expand) 2) Set to show 10 entries (columns stay the same) 3) Change alwaysCloneTop setting to false 4) Set to show 100 entries (columns expand) 5) Set to show 10 entries (columns shrink as expected)

DataTables commented 9 years ago

Thanks for the test case. I'm a bit swamped at the moment, but will look at it as soon as I can.

DataTables commented 8 years ago

Wow - long delay on this one. Sorry!

FixedHeader takes a different approach and no longer uses the alwaysCloneTop option. It appears to work as expected: https://jsfiddle.net/uahoohLs/2/ .