I am using the select2 JQuery plugin. The first option in the dropdown is labeled "All Organizations". When users search for an option, I don't want to include that first "All Organizations" option in the search results.
Is there an easy way of doing this?
It seems that the strategy would be to use a custom matcher and return null if I see that option. However, then I would need to code up the rest of the matcher, which would basically do the same thing as the default behavior. Can I somehow call the original matcher from within my custom matcher?
$("select").select2({
matcher: custMatcher
});
function custMatcher(params, data) {
if (params.term === "All Organizations") {
return null;
}
// else do regular searching
// would like to call the original matcher here.
}