Dear Helpers,
is it possible to trigger the noResults message?
I found this inside the select2.js, but is there anyway to use the trigger from the “outside”?
if (data.results == null || data.results.length === 0) {
if (this.$results.children().length === 0) {
this.trigger('results:message', {
message: 'noResults'
});
}
return;
}
What I like to archive: I have the following templateResult function, so already selected options will not be shown:
templateResult: function (result)
{
var data = $this.select2('data');
var selected = false;
$.each(data, function(key, value) {
if (result.id == value.id)
{
selected = true;
return false;
}
});
return selected ? null : result.text;
},
It would be great to show the noResults message if all the options are selected and none are shown anymore.
Thank you very much