Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stickyHeaders and horizontal scroll #491

Open
SilverSilencer opened this issue Jan 29, 2014 · 7 comments
Open

stickyHeaders and horizontal scroll #491

SilverSilencer opened this issue Jan 29, 2014 · 7 comments

Comments

@SilverSilencer
Copy link

I tried to use stickyHeaders which works great on normal table, but I have many fields and so I use horizontal scroller (I scroll to left/right), and when I move down and stickyHeaders appear, they are not shown inside that limited width div, but they go over and all fields titles are shown all the time, they are not shown inside limited width div. I tried to use stickyHeaders_attachTo, but I couldn't get it to work.

@SilverSilencer
Copy link
Author

I have uploaded demo files and modified it so that table is inside div with 600px width and you have to scroll right in order to see all data. That is all OK, but when you move down and stickyHeaders appear they are placed over all screen instead only inside div with 600px width.

You can see the problem in action here -> http://dirt3.me.pn/

Here is another example with no white-space property and with 400px width - http://dirt3.me.pn/index2.html

@Mottie
Copy link
Owner

Mottie commented Feb 2, 2014

Hi @SilverSilencer!

It looks like a class of wrapper is missing on the div wrapping the table; then set the stickyHeaders_attachTo option to that wrapper (demo):

HTML

<div style="width: 600px;">
    <div style="width:99%; overflow:hidden; height:100%; overflow-x:scroll;">
        <div class="wrapper">
            <table id="table1" class="tablesorter">
            ...
            </table>
        </div>
    </div>
</div>

CSS

 .wrapper {
    position: relative;
    padding: 0 5px;
    /*make this width smaller than the outer div, so the scroll bar is visible*/
    width: 580px;
    height: 500px;
    overflow-y: auto;
}

Script

$("#table1").tablesorter({
    theme: 'blue',
    widgets: [ 'zebra', 'stickyHeaders', 'filter'],
    widgetOptions: {
        // jQuery selector or object to attach sticky header to
        stickyHeaders_attachTo: $('.wrapper')
    }
});

@SilverSilencer
Copy link
Author

I tried this but in this case vertical scroller is shown inside div instead on right page for all page. As soon as I make height 100%, header is not attached when I scroll whole page down - http://jsfiddle.net/abkNM/1984/

@RajuTicvic
Copy link

RajuTicvic commented Aug 1, 2019

@Mottie In http://jsfiddle.net/Mottie/abkNM/1979/ attached to parent not working
why?

@Mottie
Copy link
Owner

Mottie commented Aug 1, 2019

Sorry, I didn't have time to troubleshoot. The "Attach sticky header to its parent" demo on this page does work as expected; even on narrow screens.

@cwisdo
Copy link
Contributor

cwisdo commented Aug 6, 2019

I ran into this before.

@RajuTicvic that fiddle is set to use the latest jQuery nightly build (jQuery edge) which is throwing errors because of removed functions (e.g., $.isFunction)

If you change the environment to explicitly use jQuery 3.3.1, it will work as expected

@cwisdo
Copy link
Contributor

cwisdo commented Aug 6, 2019

E.g. Here is a fiddle with the exact same code + jQuery 3.3.1 which works.

http://jsfiddle.net/cwisdo/dt52q6sj/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants