virtua icon indicating copy to clipboard operation
virtua copied to clipboard

Add `scrollToIndex` to `WindowVirtualizer`

Open jovanblazek opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I am using WindowVirtualizer to virtualize table rows, as I don't want to define fixed height for the table. I'd like to use scrollToIndex to implement find and replace functionality in my app. However, WindowVirtualizer does not have this feature.

Describe the solution you'd like Add scrollToIndex to WindowVirtualizer if possible 🙏

Describe alternatives you've considered

  • migrating to VList, but I was unable to get the table to have 100% height, like with WindowVirtualizer. I want the body of the page to be scrollable, not the table itself, as there are more elements after the table.

Additional context

  • using React

jovanblazek avatar Aug 12 '24 10:08 jovanblazek

I tried to get this working by myself but with no luck. The scrolling worked fine with 1 WindowVirtualizer, but with multiple, there were inconsistencies in scrolling behavior. (I have multiple virtualized tables on the same page)

Any chance you can take a look at this @inokawa? Perhaps I can sponsor the development if that would help 🙂

jovanblazek avatar Aug 22 '24 12:08 jovanblazek

2 or more WindowScrollers in one view will not work as expected in some situations. We have to find some workaround. https://github.com/inokawa/virtua/blob/ccd002e2c879b6f9f124d6b4b3c7b9ade252194f/src/core/scroller.ts#L413

inokawa avatar Aug 22 '24 13:08 inokawa

Released in 0.37.4. The 2 scrollers issue will be addressed in #555 .

inokawa avatar Nov 21 '24 05:11 inokawa