Remove fixed header during reload using table.destroy() and empty()

Remove fixed header during reload using table.destroy() and empty()

worldsupportworldsupport Posts: 4Questions: 1Answers: 0

On this table: https://bit.ly/3XpuhsU
we have the following problem:

When you switch in view to table view and then remove the filter you will see shortly this fixed header: https://imgur.com/a/lNwgQxi

We tried to reload the full table, described here: https://datatables.net/reference/api/destroy()
but had no luck. The initial problem was solved, but then the columns were missing in the reloaded table: https://i.imgur.com/pGHbs2I.png

Any idea what we are missing to make it properly work?

Thank you

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    Answer ✓

    One option might be to hide the table when using destroy(). Then in initComplete unhide the table and use columns.adjust() to recalculate the columns widths for the visible table.

    Kevin

  • worldsupportworldsupport Posts: 4Questions: 1Answers: 0

    Thank you for the quick answer.

    Did not get notification by e-mail so just saw by manually checking this link.

    Will try soon and let you know whether this could solve it.

  • worldsupportworldsupport Posts: 4Questions: 1Answers: 0
    edited February 2023

    Thanks

  • worldsupportworldsupport Posts: 4Questions: 1Answers: 0

    We just tested it and it works.

    Thanks a lot for the quick help!

Sign In or Register to comment.