NejcZdovc / ng2-select2

Select 2 wraper for angular2
MIT License
123 stars 93 forks source link

Dropdown getting closed once we have dynamic data returned from API ( multi select select2 use case ) #143

Open chetanmenge opened 5 years ago

chetanmenge commented 5 years ago

Scenario: I'm using ng2-select2 with multiple option set as True. Based on the entered data in search box, we are making backend call ( async ) to retrieve the result. And once we have result we are assigning back to select2 data. So it's kind of dynamic data. ( Data will be populated based on input search and it will keep on changing )

Issue which we are facing is - Once results comes back from API drop down is getting closed. So user will have to click/focus in the select2 search field to see updated data.

Question : Is there any way to show/open drop down after changing options dynamically ?

FYI, I could see select2 has open method (https://select2.org/programmatic-control/methods) $('#mySelect2').select2('data');

But anyway this can be called in the angular wrapper which we are using ( ng2-select2 )

Thanks, Chetan