Хорошо, я понял проблему в этом. Мне нужно было обработать изменения. Ниже я прилагаю обновленный код для справки.
$.fn.select2.amd.require(['select2/selection/search'], function (Search) {
var oldRemoveChoice = Search.prototype.searchRemoveChoice;
Search.prototype.searchRemoveChoice = function () {
oldRemoveChoice.apply(this, arguments);
this.$search.val('');
this.handleSearch();
};
$.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) {
$('#reports_employee_id').select2({
matcher: oldMatcher(matchStart),
templateResult: formatSearch,
templateSelection: formatSelected,
maximumSelectionLength: 25,
placeholder: " "
})
});
});
Просто нужно добавить эту строку:
this.handleSearch();
, и она работает как положено.