Closed itayganor closed 3 years ago
Your statement is correct - setting the initial location is not supported in the grid. Wrapping the call from above in a setTimeout(, 100)
should work I think.
Your statement is correct - setting the initial location is not supported in the grid. Wrapping the call from above in a
setTimeout(, 100)
should work I think.
@petyosi it means you'll end up having a flash of wrong scroll before you actually scroll to the desired index.
Is there a reason why initialTopMostItemIndex
is not supported? Will it be available in the future?
I am aware of the shortcomings of the workaround I suggested. That's why it's a workaround and not an official solution. There's no technical reason to not support initialTopMostItemIndex
. It is possible and relatively straightforward to do so, but it needs a good day or so of someones' time.
To make this clear: React Virtuoso is an open-source project which I develop, release for free, and expect nothing in return. Some people contribute to it, which is awesome, and I do my best to help. Others chose to sponsor the project in general or sponsor the development of certain features - which is also something I can accommodate if the feature is aligned with my direction of the project.
This being said, if you are willing to contribute to the project or have your company sponsor its development, please let me know.
Hi!
I'm trying to make my
VirtuosoGrid
mount scrolled to a specific index. I've seen the regularVirtuoso
has ainitialTopMostItemIndex
prop, whichVirtuosoGrid
does not have.I also tried to scroll on mount:
But it doesn't seem to work very well - my guess is that the grid hasn't finished calculating its heights yet.
What's the correct way of doing so?
Thank you! <3