FixedHeader show also if Table is hidden

FixedHeader show also if Table is hidden

des_treicheltdes_treichelt Posts: 1Questions: 1Answers: 0

Yes i did this workaround already, but i think it´s not very practicable to do this on every implemention. For me it makes no sence to show a Table-Header which Parent is not visible anymore...its only 1line of code to improve this
$(table).is(':visible') == true ? fixedheader: true : fixehader: false) ......but many lines of code for everone of us for each implemention ;).

FROM GitHub:
@DataTables
Owner
DataTables commented 6 minutes ago
You need to tell DataTables that the table has been hidden and disable the FixedHeader using fixedHeader.enable() and fixedHeader.disable().

In future, can you post support requests in the forums as requested in the new issue templ@da@da@datatables23

TomTheRock commented an hour ago
If you use the table in a tab (bootstrap) or Hide the datatable, the fixedheader shows when you scrolling...

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    $(table).is(':visible') == true ? fixedheader: true : fixehader: false)

    That's not the case. When does that line of code run? DataTables needs to be told when the tab or container has been shown or hidden. It could possibly listen specifically for Boostrap tab events, but then what about Semantic UI, jQuery UI, etc? Hence why you need to trigger an API call - which should be a single line of code:

    // In event handler
    table.fixedHeader.enable( $(table.table().node()).is(:visible') );
    

    Allan

This discussion has been closed.