bootstrap-multiselect icon indicating copy to clipboard operation
bootstrap-multiselect copied to clipboard

Enhancement suggestion: enableFiltering with a minimum

Open kobykorman opened this issue 11 years ago • 3 comments

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.

kobykorman avatar May 16 '15 18:05 kobykorman

An interesting suggestion. I will think about how to implement this.

davidstutz avatar May 24 '15 21:05 davidstutz

a quick workaround

$("select").each(function(){ filter = true if ($(this).find('option').length < 9){ filter = false } $(this).multiselect({ enableFiltering: filter, enableCaseInsensitiveFiltering: filter, }); })

bobosss avatar Jun 12 '15 13:06 bobosss

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
    });
});

niyazpk avatar Nov 10 '15 22:11 niyazpk