Open smart-select at a certain item

Is there a way to open smart-select at a certain scrollPosition?

Reason:
I have a huge list of items and I want to show the smart-select with the selected item in view.
I can get the selected item(s), but how do I bring that item into view? Do I need to query the DOM and set the scrollTop myself or is there a built-in way?

Possible, but with custom code, here is the example: https://jsfiddle.net/t29x6ms7/

I guess, i need to add it to core functionality, will be useful

@nolimits4web Thanks for the fiddle, but that didn’t work for my virtual list inside the smart-select.
But thanks to your cool api it was even easier to accomplish:

onSSOpen(ss){
    const index = ss.vl.items.findIndex((e) => e.selected === true);
    if (index < ss.vl.currentFromIndex || index > ss.vl.currentToIndex) {
        ss.vl.scrollToItem(index);
    }
}
1 Like