FixedHeader column width on table length change

FixedHeader column width on table length change

natefreynatefrey Posts: 1Questions: 1Answers: 0

This question may have been asked before but I can't seem to find a solution in the forum.

When using the FixedHeader, how can I get the header to redraw when I change the 'lengthMenu' to show records which cause the table to be rendered with different column widths?


        $(document).ready(function () {
            var table = $('#recordsTable').DataTable({
                "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
            });
            new $.fn.dataTable.FixedHeader(table, { "offsetTop": $('.navbar').height() });
         });

In my data, the width for one particular column looks different for 10 records than it does for "All" records. The table adapts the column width to the data when I update the record length selection but column width for the FixedHeader remains, not surprisingly, fixed. How do I force the FixedHeader to adapt to the new width?

This discussion has been closed.