Harvest-Dev / ng-select2

A select2 for Angular
MIT License
55 stars 32 forks source link

Issue with customSearchEnabled to load data from the server #70

Open tibin-kodelint opened 3 months ago

tibin-kodelint commented 3 months ago

The use case below was working in 13.0.4 but not in 13.0.12. I've observed the same issue in version 15 as well. Here are the component options:

customSearchEnabled = true

When the (search) event is triggered, I am making an API call to update the list. However, the already selected items disappear if they are not available in the updated list.

  1. Search for Earth.
  2. Select it.
  3. Search for Mars.
  4. Server returns the results for Mars.
  5. This list does not include Earth.
  6. The already selected Earth is no longer available.
  7. Search again for Earth. Now, Earth will reappear in the selection. This is because the list now has Earth.

I think this must work correctly when hideSelectedItems=true too.

Zefling commented 3 months ago

I tried to reproduce. But I think I must not be able to get the same case. I lose the list and close the drop-down. Do you have a test case on Stackblitz?

tibinvpaul commented 3 months ago

@Zefling - I will have a Stackblitz.