The Method from docs works well only for static select. I'm talking about the code
$('#my-select').val(id).trigger('change');
But this code doesn't work properly when I have no static options. All the data I get from ajax response. I'm trying to add default option into the DOM, select by .val(id)
and trigger it by .trigger('change')
but label of select2 span is empty. It changes if I reinit select2 for this select, but then widget lose ajax support.