sa-si-dev / virtual-select

A javascript plugin for dropdown with virtual scroll

Home Page:https://sa-si-dev.github.io/virtual-select

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Force the "scrollToIndex" when using setValue

mjesteve opened this issue · comments

commented

Hello, I have a doubt,... I am using the control in list mode, with the option "keepAlwaysOpen", but I have a problem that I don't know how to solve: when I set the value that I need to see selected, the list does not scroll to it.

Here is a visual example (as you can see, when I set the value 023, the list does not scroll to its position to make it visible)

GIF 28-06-2023 10-15-14

Is there any way to force the "scrollToIndex" when using setValue?
The behavior I expect is the same as observed when the list is opened, in "Select" mode, and positioned:

GIF 28-06-2023 10-29-23

Is there any way to force the "scrollToIndex" when using setValue?
Thx.

commented

I have updated to the latest version, 1.0.39. I have seen the new options: focusSelectedOptionOnOpen; I have activated them but I see no difference in the behavior, using keepAlwaysOpen should these options solve my problem?

Thx.

commented

To add this behavior I have modified the setValueMethod method like this:

image

The result is as expected but it may not be the best after doing it... could you give me your opinion?