[question] Using scrollToIndexes() together with pagination #15179
Labels
component: data grid
This is the name of the generic UI component, not the React module!
support: commercial
Support request from paid users
support: pro standard
Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
The problem in depth
As I understand from #6290
scrollToIndexes()
is not supposed to switch pages automatically, so we're supposed to do this by hand. Still, the only way I've managed to make it work on all cases is by wrapping the call to the API into asetTimeout()
, which doesn't feel correct.You can see the attempt in the following sandbox: https://codesandbox.io/p/sandbox/serene-wood-t5xdpl
It almost works, except when going from the last page (which is not a full page, has 25 rows while the page size is 50), to the last row in the other pages. In other words, try going to row 101 (or 125) then to row 50 (or 100), for these cases the page change happens, but the scrolling doesn't work.
The delay that fixes the problem is commented out, but we would like to have a solution that doesn't depend on it. Seems like computation of the scroll position happens based on the current viewport and not the target one, and because the last page is shorter, it fails. We have not found a way to ensure the scroll computation happens after the page switch, other than using the delay.
Your environment
Version 7.21.0 from the sandbox.
Search keywords: scrollToIndexes, pagination
Order ID: 93242
The text was updated successfully, but these errors were encountered: