bootstrap-multiselect
bootstrap-multiselect copied to clipboard
Enhancement suggestion: enableFiltering with a minimum
It would be great if enableFiltering would accept an integer as well, being the threshold of options required to display the filter/search box.
Similarly to Select2's minimumResultsForSearch.
An interesting suggestion. I will think about how to implement this.
a quick workaround
$("select").each(function(){ filter = true if ($(this).find('option').length < 9){ filter = false } $(this).multiselect({ enableFiltering: filter, enableCaseInsensitiveFiltering: filter, }); })
For anyone using the above workaround, don't forget to add "var" before the first occurance of filter:
$("select").each(function() {
var filter = $(this).find('option').length > 9;
$(this).multiselect({
enableFiltering: filter,
enableCaseInsensitiveFiltering: filter
});
});