I've spend an hour trying to make this jsfiddle splendid selectize modification to stop close (stopPropagation) on option selection , but I am now feeling helpless. Do I have to use some of selectize option for this ? I've read the doc through, but found nothing relevant. The only relevant option seems to be closeAfterSelect, but its default value is false :( Any ideas ?
$('.dropdown').each(function() {
$_self = $(this);
$_self.find('select')
.selectize({ plugins: ['component'], maxItems: 1, closeAfterSelect:false })
.on('change', function() {
console.log('Changed value to:', $(this).val() )
$_self.find('span.value').text( $(this).val() )
if ($(this).val()) {
$_self.removeClass('open');
}
});
$_self.find('select').on('click', function(e) { e.stopPropagation(); });
$_self.find('.dropdown-menu').on('click', function(e) { e.stopPropagation(); });
$_self.find('.dropdown').on('click', function(e) { e.stopPropagation(); })
});
Once again to clarify - I want the drop down to close only when I press the caret. If I choose any option, I want it to stay open. As you may notice, I've added the stopPropagation method on each class and element possible and yet can't get it work as expected