Bug with table headers and vertical scroll bar (plunker + potential fix)

Bug with table headers and vertical scroll bar (plunker + potential fix)

kbg2289kbg2289 Posts: 3Questions: 0Answers: 0

Hi All(an),

Noticed an issue with the datatables header getting a bit messed up as is demonstrated in this plunker:

http://plnkr.co/edit/96eAeq2F17gckRxydEFN?p=preview

In this particular example (and in the website I'm developing) we have css code that directly trims the size of the body like so:

@media (max-width: 800px) {
body {
/.../
max-width: 90%;
/.../
}

In the datatables method _fnBrowserDetect() we have the following line:

    browser.bScrollbarLeft = test.offset().left !== 1;

Problem is when the body is trimmed, as in this example, the offset is something other than 1. For me it was something like 42.xx in my debugging. I've made the following alteration in my code which fixed it for me for most browsers, but I imagine it has to pass a more rigorous set of tests to make it into DT anyways:

    if (test.parent()) {
        browser.bScrollbarLeft = test.parent().offset() / test.offset().left > 1;
    } else {
        browser.bScrollbarLeft = test.offset().left !== 1;
    }

Let me know your thoughts...

-Keith

Replies

  • kbg2289kbg2289 Posts: 3Questions: 0Answers: 0

    That should be:

        if (test.parent()) {
            browser.bScrollbarLeft = test.parent().offset().left / test.offset().left > 1.0;
        } else {
            browser.bScrollbarLeft = test.offset().left !== 1;
        }
    
  • jprogrammerjprogrammer Posts: 1Questions: 0Answers: 0

    Thanks Keith,

    I found that this fixes when you have a paged zoomed at a ratio other than 100% in chrome

  • kbg2289kbg2289 Posts: 3Questions: 0Answers: 0

    Nice... totally had no idea it would do that, but that's great.

This discussion has been closed.