Basically what I\'m looking for is the ability to hide options from the dropdown of select items. So, technically they would still be options, but you just wouldn\'t be able
I just made a variation of he answer 6 and changed class by hidden attribute, so this way every option with hidden attribute will also be hidden in a select2 container like below that the option 1 will be hidden:
$('.mySelect').select2({templateResult: hideSelect2Option});
function hideSelect2Option(data, container) {
if(data.element) {
$(container).addClass($(data.element).attr("class"));
$(container).attr('hidden',$(data.element).attr("hidden"));
}
return data.text;
}