munge placeholder from select2 typeahead search bar

This commit is contained in:
jlmitch5 2017-10-31 14:39:25 -04:00 committed by GitHub
parent fbd03287ea
commit b8ed41fa82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -636,6 +636,22 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
if (!multiple) {
config.minimumResultsForSearch = 1;
config.matcher = function(params, data) {
// If there are no search terms, return all of the data
if ($.trim(params.term) === '' &&
data.text.indexOf("Choose an") === -1) {
return data;
}
// Do not display the item if there is no 'text' property
if (typeof data.text === 'undefined' ||
data.text.indexOf("Choose an") > -1) {
return null;
}
// Return `null` if the term should not be displayed
return null;
};
}
}