mkoryak / floatThead

Fixed <thead>. Doesn't need any custom css/html. Does what position:sticky can't
https://mkoryak.github.io/floatThead/
MIT License
1.22k stars 196 forks source link

Firefox: Problem with RTL Tables #449

Open alex2230 opened 4 years ago

alex2230 commented 4 years ago

Hi, I know that: "RTL is not really supported by floatThead" floatThead works well on Chrome, and has no problems with RTL tables, But floatThead+RTL tables are not working properly on Firefox.

Is there a way to fix the problem with Firefox?

Please see the links below with Firefox And screen width smaller than 900 pixels: I've used the "Bootstrap table responsive". LTR: https://codepen.io/alex200/pen/XWWqLaQ RTL: https://codepen.io/alex200/pen/VwwxJWe

mkoryak commented 4 years ago

sorry, this fell off my radar. Ill look soon

mkoryak commented 4 years ago

This happens because of how different browsers calculcate scrollLeft in RTL. you need to include the following workaround to fix this:

https://github.com/othree/jquery.rtl-scroll-type

and this code:

var origScrollLeft = jQuery.fn.scrollLeft;
jQuery.fn.scrollLeft = function(i) {
    var value = origScrollLeft.apply(this, arguments);

    if (i === undefined) {
        switch(jQuery.support.rtlScrollType) {
            case "negative":
                return value + this[0].scrollWidth - this[0].clientWidth;
            case "reverse":
                return this[0].scrollWidth - value - this[0].clientWidth;
        }
    }

    return value;
};

Copied from: https://stackoverflow.com/questions/24276619/better-way-to-get-the-viewport-of-a-scrollable-div-in-rtl-mode/24394376#24394376

I didnt test this, but this is what is happening here.

alex2230 commented 4 years ago

@mkoryak Thanks for reply.

The jquery.rtl-scroll-type plugin adjusts the RTL-table header correctly, but when user scrolls left and right, the header does not change and is fixed!

Please see the links below with Firefox And screen width smaller than 900 pixels: https://codepen.io/alex200/pen/MWWNMzQ

mkoryak commented 4 years ago

That's fun, I should have guessed some other calculations would need to be inverted. I'm upgrading this to a bug.

swdreams commented 2 years ago

Hi, I like this repository, but it's pity that it doesn't support a functionality to freeze left column(s). Is it possible or are there any good source? Thanks

mkoryak commented 2 years ago

No, this plugin does not do this and there are no plans for it.

Feel free to write your own :)

On Tue, Nov 2, 2021, 12:16 AM Senior software architect & engineer < @.***> wrote:

Hi, I like this repository, but it's pity that it doesn't support a functionality to freeze left column(s). Is it possible or are there any good source? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mkoryak/floatThead/issues/449#issuecomment-957088115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC5WSLF2L675ASNEYB3KP3UJ5QYBANCNFSM4JLJATHQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.