-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[question] onRowsScrollEnd is never fired when initial data rows height less than table height #4184
Comments
Yes, I can reproduce it with static grid height: https://codesandbox.io/s/infiniteloadinggrid-material-demo-forked-fb441f?file=/demo.tsx |
Will there be ETA for this issue? This basically makes the infinite scrolling feature unavailable. |
We will look into it |
Hi, i'm having the same issue. Any eta? |
created a temporary workaround for anyone having the same issue. It's not pretty but it works in practice. const ref: React.MutableRefObject<HTMLDivElement | null> = React.useRef(null);
<div ref={ref}>
< Grid ....
</ div> React.useEffect(() => {
const pageHax: number = (ref?.current?.clientHeight ?? 1) / 600; // 600 is the size of initial list height in px
// here for example, i load 10 items and they exceed the size of 600px
if (pageHax > uniqueList.length / 10 && !PageIsLoading && uniqueList.length > 0) {
handleOnRowsScrollEnd();
}
}, [uniqueList.length]); |
Hey |
This is a possible workaround, but we can't assume the screen height of our users. The best we can do for now is adding a load more button at the end and ask users to click it. Maybe we can use intersection observer to find out when the button appears in viewport, and do the loading automatically. |
By the way, why does screen size matter? Do you use |
Yes, the grid takes full browser height. |
I'm experiencing the same issue trying to implement the infinite scrolling. Only when the |
this is the proper way to achieve infinite scroll, hopefully we got this feature sooner. I have an idea, add a slot for last row (empty div), and then we use IntersectionObserver on the last row empty div for infinitescroll. simple and precise solution #7416 this pr can solve the infinite scroll issue, pls take a look guys! |
having the same issue, this also happens if the rows fit (almost )exactly ... I assume when the scrollable area is lower than the https://codesandbox.io/s/sleepy-farrell-uo38ju?file=/demo.tsx |
Order ID 💳
#35352
Duplicates
Latest version
The problem in depth 🔍
When the page is loaded first time, I fetched some initial data rows (e.g. 10 rows), displayed them in DataGridPro. Depending on the screen size of the users, the height of these rows may or may not exceed the height of the table, therefore a scrollbar may or may not be shown.
In the case a scrollbar did show, the user can simply load more data by just scrolling down the page, which will trigger
onRowsScrollEnd
correctly. However in the case of a larger screen, the scrollbar did not show, so DataGridPro will not triggeronRowsScrollEnd
, therefore the user has no way to load subsequent data.I would like to implement an infinite scrolling behavior that doesn't depends on the user's screen size. That is, DataGridPro should repeadedly load the data until a scrollbar is shown. Is this possible?
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: