Thursday, 27 June 2019

PrimeNG dropdown with virtual scroll not keeping selection in view

I am making use of the PrimeNG drop down component with custom filtering and virtual scroll enabled.

I am finding the component is not scrolling back to the last selection made in the list of items in view when it's re-opened, instead it just scrolls back to the top of the list meaning you have to physically scroll to go find the selection made.

See this example stackblitz

I did come across a solution here that talks about calling scrollToIndex on a CdkVirtualScrollViewport instance which sound like it could be of use for me. But when I attempted to incorporate this in my code, my instance variable comes up as undefined.

Does anyone know what the correct approach is here? I am using PrimeNG 7.1.3.

Thanks



from PrimeNG dropdown with virtual scroll not keeping selection in view

No comments:

Post a Comment