FixedHeader: Floating header columns widths are not updated when data column widths change
FixedHeader: Floating header columns widths are not updated when data column widths change
Hi there,
sorry if this is trivial. Haven't found an answer in the forum or in the documentation, though, and it is bothering me:
I'm using the FixedHeader (DT 1.10.4, FH 2.1.2) extension with search (per column (custom made) and global). If due to search results, or due to window re-sizing, the column widths of the data columns change, the Fixed Header column widths are not adjusted. The Fixed Header just stays as it was and doesn't match the data columns anymore.
I've made up an example here: http://live.datatables.net/vofijosa/1/edit?output
Should be fairly easy to see what I mean, just play around with the window size and watch the header row.
Is there any way to deal with this? I've tried the utilize the column-resizing event to call fnUpdate / fnPosition, but that doesn't seem to work. Neither is the event ever triggered, nor does calling fnUpdate or fnPosition have any apparent effect.
Does this mean anything to anyone? It seems so basic that I can't imagine I'm the first one coming across this...
Thanks for reading!
Answers
Correction: Column width changes as a result of filtering / searching don't fire the column-sizing.dt event. Therefore, they don't cause the fixed header to adjust either.
Unfortunately, it's not possible to fix this with satisfactory results. When I force the header update in the search.dt event, the problem is that this event is fired before the search is applied, therefore also before the columns have been resized, which is useless. It always adjusts according to the results of the previous keystroke in the search input field.
Worse, forced header update (_fnUpdatePositions(true); _fnUpdateClones()) doesn't preserve the text in my column-related input fields. Apparently, the header objects are re-created instead of just being moved to their new positions.
Same problem here...