-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DataGrid] onRowsScrollEnd
triggered when applying filters
#11402
Comments
onRowsScrollEnd
triggered when applying filters
Hey @sorinpav I am not able to open your live example. It is stuck at |
@michelengelen I will have a look, thanks for letting me know. I'll edit the link in a few minutes. |
@michelengelen I edited the link in the main description. This should now work, hopefully. I'll add it here for visibility as well. https://stackblitz.com/edit/react-bpfeec?file=Demo.js |
OK, thanks for fixing that example. From your description it seems when filtering and the results return a small enough amount of rows the |
@michelengelen yes, exactly, and we would wish to be able to fetch results from the server only when intentionally scrolling down, not when filtering. |
Currently, we added a workaround with a useEffect that listens to the statechange event, and gets the number of visible rows by using
and then using On the performance side of things, it's extra requests to the server that the user hasn't asked for, so that is why we would prefer the event to not trigger, because we haven't solved that with our workaround. Posting the code here to help others who may encounter the same issue, and don't mind the extra requests. @michelengelen if you have any better ideas please shout up! Thanks for the help! |
Also, I understand that the event triggers when it thinks it's reached the end of the list of rows, but I don't think it's correct for that to happen when the user is just filtering results, as of course you're going to reach the end of the list if you're looking for one particular result only. |
I think this relates to this PR #8672. The goal of the PR is to rework the way that the I'll close this in favor of #4371 as it is essentially a duplicate. |
Steps to reproduce
Link to live example: https://stackblitz.com/edit/react-bpfeec?file=Demo.js
Steps:
Current behavior
The onRowsScrollEnd event gets triggered when using row filters.
Expected behavior
The onRowsScrollEnd should not be triggered by that.
Context
We have an "X results displayed" string above the dataGrid, that says how many results are displayed, and when filtering, that number increases as it's getting the second batch of results, making it inaccurate (we don't use pagination).
Your environment
System: OS: Windows 10 10.0.19045 Binaries: Node: 20.9.0 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1266.0), Chromium (120.0.2210.61) npmPackages: @emotion/react: ^11.11.1 => 11.11.1 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.22 @mui/core-downloads-tracker: 5.14.16 @mui/icons-material: ^5.14.16 => 5.14.16 @mui/lab: ^5.0.0-alpha.151 => 5.0.0-alpha.151 @mui/material: ^5.14.16 => 5.14.16 @mui/private-theming: 5.14.16 @mui/styled-engine: 5.14.16 @mui/system: 5.14.16 @mui/types: 7.2.8 @mui/utils: 5.14.16 @mui/x-data-grid: ^6.14.0 => 6.18.1 @mui/x-data-grid-premium: ^6.16.1 => 6.18.1 @mui/x-data-grid-pro: 6.18.1 @mui/x-date-pickers: ^5.0.15 => 5.0.20 @mui/x-license-pro: 6.10.2 @mui/x-tree-view: 6.0.0-alpha.1 @types/react: 17.0.3 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.2.2 => 5.2.2
Search keywords: onRowsScrollEnd
Order ID: 77486
The text was updated successfully, but these errors were encountered: