Scroller & KeyTable in combination

Scroller & KeyTable in combination

fabianrottfabianrott Posts: 30Questions: 1Answers: 0

Hi!
I have trouble using KeyTable and Scroller in combination. To demonstrate it, i created a jsfiddle. (I just inserted a few copies of the same data, but you should get the point)

The problem is, if you scroll down a bit (half of the lines or so) and try to select a cell by mouse click, the scrolled section jumps up and you don't see the cell you just selected. If you click again in the section you just jumped to, this repeats until you end up close to the top, but even then you might get weird jumps.

Replies

  • fabianrottfabianrott Posts: 30Questions: 1Answers: 0

    Did anybody here observe something like that? It seems to depend on the window size (or rather, the number of lines initially shown) as well. Apparently these jumps appear more often in small browser windows.

  • allanallan Posts: 63,489Questions: 1Answers: 10,468 Site admin

    Thanks for pointing this out and for the test case. This is most certainly a bug. I'll take a look into it and post back here when done.

    Allan

  • allanallan Posts: 63,489Questions: 1Answers: 10,468 Site admin

    I've just committed a fix for this issue. Thanks again for letting me know about it.

    The nightly will rebuild with the fix in a few minutes and it will be in the next release of KeyTable.

    Regards,
    Allan

  • fabianrottfabianrott Posts: 30Questions: 1Answers: 0

    Hi Allan!
    Thank you for your fix! It works in the test case.

    However, I ran into problems integrating it in my project. The behaviour was the same as before. After some digging, I recreated the test case in DataTables live and it didn't work there, too. Comparing the two, I found out that the only noticable difference is that I used jQuery 2.1.4 in DT live (like in my own project), while I had used 2.2.0 in the jsfiddle example for some reason I don't remember.

    As it turns out, using 2.2.0 fixes the problem in both DT live and my project. Strangely, using the most recent jQuery 2.2.3 breaks it again. I guess that's related to https://github.com/jquery/jquery/commit/ee0f61647cb93d587764280b1278807d9ff86fc9

    Is there another way to fix this problem that can deal with the different jQuery versions?

  • allanallan Posts: 63,489Questions: 1Answers: 10,468 Site admin

    Thanks for letting me know about that. I'll take a look into it and post back when done.

    Allan

  • fabianrottfabianrott Posts: 30Questions: 1Answers: 0

    Hi Allan!
    Did you have time to investigate this?

  • allanallan Posts: 63,489Questions: 1Answers: 10,468 Site admin

    I actually removed the fix from my above commit (reversal made here). There was a bug in jQuery 1.12.0 and 2.2.0 which caused the issue we were seeing in Scroller.

    As such, Scroller will not work correctly with those two versions of jQuery - however, since it was a jQuery bug and it works correctly with the latest version I don't plan to introduce a workaround for those two versions.

    Allan

  • fabianrottfabianrott Posts: 30Questions: 1Answers: 0

    Hmm. What I meant was that the behaviour was broken with jQuery 2.1.4, 2.2.0 and 2.2.3. Your fix only repaired it in combination with 2.2.0.

    But one of the following commits to KeyTable seems to have fixed it now, so thank you for that!

  • allanallan Posts: 63,489Questions: 1Answers: 10,468 Site admin

    Good to hear!

    It won't work with jQuery 2.2.0 or 1.12.0, but that's a bug in those specific versions of jQuery.

    Allan

This discussion has been closed.