-
Notifications
You must be signed in to change notification settings - Fork 164
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
scrollToLeft not stopping current scroll, and no possibility to add initial offset #285
Comments
Hi, thanks for the detailed information, first of all I'd I'm not fully understand your problem, but yes scroll methods won't cause table re-rendering, but if you change for scrollbar width you can use |
Thanks for your answer ! At the beginning I was thinking to use react-window directly to virtualize columns for each day, but :
Because of these features it was complicated to considered each day as a single column. So my solution was to consider a "window" of 3 weeks as the main column (so the column width is 21 days * DAY_WIDTH = 1680px). Each time we scroll in the past (or the future), i shift my window 1 week in the past (or 1 week in the future). So the size of the window (and so the size of column) is always the same. I will try getScrollbarSize to get the scroll width. Thank you for the time you took to answer me, and for this awesome library :) |
Hello here,
First I would like to thank you for this great library, I am doing a complex screen with scroll vertical, horizontal and drag n drop, I tried to do it with react window but I was not able to have a fixed column easily, I discovered your awesome library and it simply save my life ! So thanks a lot 🙏
To add some context, I am doing this screen :

This component displays planning of users. Among the features I have to implement, here are some elements :
I have implemented a solution and here is a codesandbox grouping only problematics on scroll (forget about drag and drop for the moment, I will do it once I solve my problems of scrolling).
So, several problems on my side :
I have created a Base Table with n rows (n = numbers of users, n is growing each time we scroll vertically) and 3 columns :
1 column for user name (fixed), 1 (big) column for user planning, and 1 column blank to manage the scroll left (let's call this column "Loading").
So, first I would like to have an initial scroll offset of size "Loading column", giving to the user the impression he can scroll left. Each time the user scroll left, I will :
(same for scroll right, adding + 1 week)
I do not know how to add this initial scroll left, I am currently using :
But this does not work since tableRef.current is a mutable value and changing it does not re-render component. Adding no dependencies on the useEffect does not work either.
Moreover, here is my current onScroll method :
The problem with this code is that sometimes when I scroll left, scrollToLeft works correctly and I get stuck on offset left = loading column, which is the behaviour I want to have. And sometimes the scroll goes to offset left = loading column, but it is not "stopped", so it continues to scroll left until 0. So there is no offset left anymore, and if user wants to scroll left again, is has to first scroll right, then scroll left to trigger the fetching of past planning.
One thing to know : I did not have the problem using react-window directly :
worked
Finally, for the right scroll, I am using
props.scrollLeft - SCROLL_MARGIN === tableRef.current.getTotalColumnsWidth() - scrollRef.current.scrollWidth
to get a condition to fetch new data for future planning (where SCROLL_MARGIN is an arbitrary value of 15px), but I think this does not work well on all device screens.Do you have any idea on how could I resolve my problems ? 😢
Thank you !
The text was updated successfully, but these errors were encountered: