Destroying a fixed header

Destroying a fixed header

rmmcgrrmmcgr Posts: 3Questions: 2Answers: 1

I have multiple DataTables on a page, each on a Bootstrap tab, each with fixed header enabled.

User interaction causes the DataTables to be refreshed via ajax. After the Ajax load I re-initialize the DataTable. I am using the "destroy":true option.

However I find that while a DataTable is destroyed, the fixed headers keep showing up on the wrong tab (slightly overlaid on top of what should be the specific tab's own fixed header).

If I try and manually call the destroy function, the fixed headers keep showing up (from the old table).

What is the correct way to get rid of them so that when a recreate a table from an Ajax call, and re-initialize the table, everything shows up in the correct place?

Answers

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    I'm having the same issue, unable to remove the fixedheader from the DOM when I perform an ajax that inserts the same table a 2nd time (or 3rd or 4th ...). If you found a solution, I'd be interested in knowing what it is.

  • allanallan Posts: 61,649Questions: 1Answers: 10,093 Site admin

    Hi,

    Are either of you able to give me a link to a page showing the issue? I've just done a little test case to check that destroy works with FixedHeader: http://live.datatables.net/hatisige/1/edit .

    My guess is that you need to call fixedHeader.adjust() when the DOM changes are made so DataTables can know about that.

    Regards,
    Allan

  • lbouriezlbouriez Posts: 1Questions: 0Answers: 0

    Hi,
    I am having the same issue, using datatables filled by an ajax request and when I load other tables in the pages via ajax, I got duplicate,... fixed header, for every table a new fixed header.
    I am blocked on this since days :( do you have an idea of what I could do ?
    I tried to add a call to adjust after the load of the tables, it doesn't work BUT if I cahnge the size of google chrome, all the wrong fixed header disappeared and I got what I want..

  • allanallan Posts: 61,649Questions: 1Answers: 10,093 Site admin

    Happy to take a look at a test case showing the issue.

    Thanks,
    Allan

This discussion has been closed.