Disable/hide fixed header when horizontal scrollbar displayed

Disable/hide fixed header when horizontal scrollbar displayed

nsscottnsscott Posts: 24Questions: 10Answers: 0

I understand that the Fixed Header does not function properly when the horizontal scrollbar is shown. In a previous support session it was recommended I hide the fixed header element. Unfortunately my notes on this are rubbish! Can someone point me in the right direction? My notes are as follows in case they make sense to anyone else!

Step 1: Check if container is scrolling (container width compare)
Step 2: Add class to set fixed header element to display none (Body.hideHeader table.fixedHeader-floating { display: none !important; }

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,106Questions: 1Answers: 10,574 Site admin
    Answer ✓

    Use fixedHeader.enable() and fixedHeader.disable() to enable and disable FixedHeader rather than setting your own classes.

    Allan

  • nsscottnsscott Posts: 24Questions: 10Answers: 0

    Thanks Allan! Works a treat:

    `
    var isHorizonalScrollbarVisible = false;
    function AdjustFixedHeader() {
    var isVisible = $('.TableContainer').get(0).scrollWidth > $('.TableContainer').innerWidth();
    if (isHorizonalScrollbarVisible !== isVisible) {
    table.fixedHeader.enable(!isVisible);
    isHorizonalScrollbarVisible = isVisible;
    }
    }

    $(window).resize(function () {
    AdjustFixedHeader();
    });
    `

This discussion has been closed.