-
-
Notifications
You must be signed in to change notification settings - Fork 67
Fix: redraw top and bottom should acknowledge edge conditions #41
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR! Could you link to a test case which shows the problem please so I can confirm the issue and the fix. Also, if you could confirm that you are happy for your changes to be included under the current MIT license, that would be great. |
Thanks for making DataTables available! It's a pleasure to read through and work with. I am happy for the changes to be included under terms of the MIT license, and will try to isolate a test case. However I think it's going to be hard to do so without significant effort or violating my employers IP rules. One way or another, I'll let you know. |
Yup - I understand. I fairness the change looks fairly trivial - certainly for redrawTop, I'd be willing to just take that one. But I'd like to understand the redrawBottom one a bit more. Also it looks like you added |
Argh, that's what I get for "cleaning up" before I submit. Line 799 should read: this.s.redrawBottom = Math.min(iScrollTop + boundaryPx, iScrollHeight - iScrollTop); As you can probably tell, I'm not used to Githib's UI at all, but can try to update the PR. |
Looking deeper, that isn't right either - it will draw too often. A little more about my reasoning: My understanding is that a redraw is supposed to be triggered when this.dom.scroller.scrollTop is larger than this.s.redrawBottom (line 597). Given that, I think that this.s.redrawBottom should be, at most, the height of the scroller minus the height of the visible area, which is not iScrollHeight - iScrollTop. My PR "Worked" because is always set this.s.redrawBottom to a value that is too small. I'll see if I can get it right, and come back with that. |
I believe this actually captures my intent:
|
Yeah - these calculations are darn tricky, which is why I was wondering if you might be able to bash together a test case so I can try it out. Thanks for following up on this - looks like it could be a good fix to have in Scroller! |
Ok, I think this should do it:
Sorry for the messiness. Things to note:
|
As a side benefit, there's a mostly working proof of concept for enabling fixed columns and scroller together there. I'd appreciate any advice you could offer for making sure that the vertical offsets between the two tables stay in sync a little more robustly. |
Since nobody else is complaining about this, my guess that this is happening to us due to the various ways that we're abusing/misusing DataTables (simulating infinite scroll, using fixed columns, sizing through CSS).
This changeset ensures that a redraw is triggered when we scroll to the bottom of the virtual area.