vuejs3primevue

How to listen to the scroll event of the VirtualScroller inside MultiSelect in PrimeVue 3 via PT?


What I'm trying to achieve is to listen to the scroll event of the VirtualScroller inside a MultiSelect, so that every time the user scrolls the dropdown panel, I can trigger a custom function.

I saw that MultiSelect supports the pt (PassThrough) prop, so I tried the following:

<MultiSelect :pt="{virtualScroller: onScroll:doSomething}"></MultiSelect>

But this doesn't seem to work — no scroll event is being fired. Is there a correct way to attach a scroll listener to the VirtualScroller used internally by MultiSelect via pt?


Solution

  • To set props and events of the VirtualScroller inside MultiSelect there is the virtualScrollerOptions prop that is meant to be used:

    <MultiSelect :virtualScrollerOptions="{ itemSize: 20, onScroll: doSomething }"></MultiSelect>