vue-virtual-scroller icon indicating copy to clipboard operation
vue-virtual-scroller copied to clipboard

Adding to beginning of items

Open alan-bradbury opened this issue 6 years ago • 6 comments

When items are added to the beginning of the items array the scroller displays the first items rather than staying put

alan-bradbury avatar Apr 30 '19 22:04 alan-bradbury

Just commenting so I get notified about any comments on this thread. I've implemented a rather hackish workaround for this to calculate how far from the bottom of the list a user is scrolled before adding items the the underlying array, then forcing the position back to about where it was (in a bunch of nested $nextTicks so it doesn't jump around), but the code for it is a right mess :flushed:

nahanil avatar May 01 '19 10:05 nahanil

When items are added to the beginning of the items array the scroller displays the first items rather than staying put

This is standard scroll behavior in browsers.

Akryum avatar May 01 '19 10:05 Akryum

@texh I'd love to see that code to save me writing it myself 😀

@Akryum it would be good to have a choice of what behaviour you wanted

alan-bradbury avatar May 01 '19 20:05 alan-bradbury

The virtual scroller is not responsible for this behavior. 😸

Akryum avatar May 01 '19 20:05 Akryum

It's possible to <DynamicScroller ref="scroller"> and use it's $refs.scroller.scrollToItem(index) function and scroll to desired index if You know how many items where prepended to the list but the animation still is

priithansen avatar Nov 11 '21 22:11 priithansen

It's possible to <DynamicScroller ref="scroller"> and use it's $refs.scroller.scrollToItem(index) function and scroll to desired index if You know how many items where prepended to the list but the animation still is

But that might cause flickering...

iakoug avatar May 10 '23 03:05 iakoug