fabianlindfors / multi.js

A user-friendly replacement for select boxes with the multiple attribute enabled
https://fabianlindfors.se/multijs
MIT License
953 stars 76 forks source link

Dynamic change data source. #20

Closed szastarek closed 4 years ago

szastarek commented 6 years ago

Hello, Awsome work! I have one question is it possible to dynamicly change the data source with AngularJS? I'm getting data from http response and in every change I need to click on the list to see new data. Thanks for the response :D

fabianlindfors commented 6 years ago

Hi! There currently isn't any built-in support for custom data sources. Because multi.js simply mirrors an underlying select element you could probably update the select element with your HTTP request and then trigger the 'change' event to make multi.js refresh itself.

I haven't tried this myself so please report back if you get it working!

danilopolani commented 6 years ago

EDIT: The problem was the .length at line 61, weird, with a timeout I solved it.

@Fabianlindfors I get remote data, put it in a select and then initialize multi() with jQuery. I have 100 items, but at first time only the first item appears in the widget, but when I click it, additional 17 options are loaded (and not all of them), please see the GIF below. Any idea?

gif