vertical-collection icon indicating copy to clipboard operation
vertical-collection copied to clipboard

Scrollto element is not working while using vertical collection in power select option

Open GnanaAjana opened this issue 5 years ago • 3 comments

I am using the vertical collection for power select. I am doing scrollTo action to highlight an option and scroll down key action.

Issue: While triggering scrollTo, vertical collection DOM options are not loaded. So I can't able to scrollTo the highlighted option. After execution of scrollTo of power-select, vertical collection options are loaded...

Is there any other way to resolve this.

Version: "ember-cli": "2.12.3", "@html-next/vertical-collection": "1.0.0-beta.12"

GnanaAjana avatar May 28 '19 05:05 GnanaAjana

We're doing something similar. The solution we came up with is to check if the element we want to scroll to is already rendered/loaded. If not, we render it and calculate the scrollTop position of that element. Hope it makes sense.

herzzanu avatar May 30 '19 09:05 herzzanu

@herzzanu Thanks. Issue is resolved. I tried to set a scrollTop position after the vertical collection option is rendered using setTimeout.

GnanaAjana avatar May 30 '19 16:05 GnanaAjana

Nice. To make it nicer you can use an ember concurrency task and use timeout. Then you can use the task states for different behaviors like disabling some controls or showing placeholders for example ;)

herzzanu avatar May 30 '19 22:05 herzzanu