html-next / vertical-collection

Infinite Scroll and Occlusion at > 60FPS
https://html-next.github.io/vertical-collection/
MIT License
176 stars 76 forks source link

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

Open GnanaAjana opened 5 years ago

GnanaAjana commented 5 years ago

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"

herzzanu commented 5 years ago

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.

GnanaAjana commented 5 years ago

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

herzzanu commented 5 years ago

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 ;)