Fixed Header

Fixed Header

marekgmarekg Posts: 6Questions: 3Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: I'm successfully using DataTables with Responsive and FixedHeader plugins. I've configured FixedHeader to keep the table header at the top of the window while scrolling down. I'd like the header to stay/be fixed at the specified place - on the top of the DIV instead of top of the window. Is it possible? Maybe I could detach the header from the table somehow? Thanks.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 56,836Questions: 1Answers: 9,033 Site admin
    Answer ✓

    You can put an offset on the fixed header as shown in this example, but that's about it. It doesn't account for a div with its own scrolling I'm afraid.

    Allan

  • marekgmarekg Posts: 6Questions: 3Answers: 0

    Thank you, Allan.
    I've applied the fh-fixedHeader class to the Bootstrap 5 "container" div and it worked, but when I resize the browser window, the table header is improperly going up and behind the div and also it gets duplicated:

    Do you have any advice for this?
    Best regards.

  • allanallan Posts: 56,836Questions: 1Answers: 9,033 Site admin
    Answer ✓

    Calling fixedHeader.adjust() on resize would probably do it.

    Allan

  • marekgmarekg Posts: 6Questions: 3Answers: 0

    Thank you, Allan.
    I've fixed this problem mainly by manually setting height of the div which has fh-fixedHeader class (duh).
    DataTables is a great software :smile:

Sign In or Register to comment.