scroll a row into view #408
-
Does anyone have a working example for making a row scroll into view on load, using Here's what I've tried: I set a custom data attribute on the target row:
... and then try to scroll to it in a useEffect:
No luck, though -- seems the grid hasn't been loaded by that point. Anyway, I'm sure I'll find the secret sauce soon, just wondered if anyone had managed it yet. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Similar question here. Maybe another way ...... could just be to assign an |
Beta Was this translation helpful? Give feedback.
-
I like the idea of using the A few things to keep in mind, though: First, you need to keep in mind that the Second, you have to make sure the table rendered its content before attempting to scroll. For instance, you could consider triggering the scroll in a Let me know if this works for you. |
Beta Was this translation helpful? Give feedback.
-
Thanks, confirmed that I tested this strategy and it works well. |
Beta Was this translation helpful? Give feedback.
-
One thing I didn't like when using See the second example on the docs page here: icflorescu.github.io/mantine-datatable/examples/scrolling-a-row-into-view |
Beta Was this translation helpful? Give feedback.
-
I'll summarize the final answer here, for the benefit of other people bumping into this:
|
Beta Was this translation helpful? Give feedback.
I'll summarize the final answer here, for the benefit of other people bumping into this:
useEffect()
depending on on what you're passing to the tablerecords
.)