Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Fetch when scroll at the bottom ? #1749

Open
Dimitri-Habruk opened this issue Jan 31, 2024 · 4 comments
Open

How to Fetch when scroll at the bottom ? #1749

Dimitri-Habruk opened this issue Jan 31, 2024 · 4 comments

Comments

@Dimitri-Habruk
Copy link

Dimitri-Habruk commented Jan 31, 2024

Screenshot_88

Hi all.

I don't found information about how i can check when scrool at the bottom, for do new fetch ?
for the Options.

Thanks !

@Dimitri-Habruk
Copy link
Author

i'm trying this :
<multiselect
@scroll="fetchData"
>
But it's not working

@foggy54
Copy link

foggy54 commented Mar 24, 2024

i'm trying this : <multiselect @scroll="fetchData" > But it's not working

Hello, have you managed to solve your question? I'm looking for solution which allow partial loading of the options for large lists, something similar to Select2.

@lehoaibaokg
Copy link

lehoaibaokg commented Dec 27, 2024

Just an idea, I think we can wrap the vue-multiselect into the custom multiselect component, inside that component we can add scroll event listener into the list, and check whether scrolling to bottom then we will call API with the next offset data

<vue-multiselect
    ref="multiselect"
    :value="value"
    :options="options">
</vue-multiselect>
const listElement = this.$refs.multiselect.$refs.list;
listElement.addEventListener('scroll', () => {
    const isScrolledToBottom = listElement.scrollHeight - listElement.scrollTop === listElement.clientHeight;

    if (isScrolledToBottom) {
        // Call the API and append the next data to the options
    }
});

While calling the API, we can display the afterList slot with the loading spinner, when we have the new data added to options, we will hide this slot

@Dimitri-Habruk
Copy link
Author

foggy54

not yet. still waiting on help, from somebody :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants