The problem: I need to add new option with data from api when there is no results in matcher.
Is it possible to add a new option from matcher function in select2 library?
When I use
var option = new Option("text", "id");
$("#id").append(option);
$("#id").trigger("change");
in matcher function, it adds a new option but only on the next input event.