Ajax-Bootstrap-Select icon indicating copy to clipboard operation
Ajax-Bootstrap-Select copied to clipboard

behaviour on close / reopen

Open GuilhemSempere opened this issue 5 years ago • 1 comments

I'm using a multiple select and find it odd that after closing / reopening the widget the previously typed text disappears from the search input, whereas the items which matched that search are still available in the list below it. Is there any option to make it more consistent?

GuilhemSempere avatar Oct 07 '19 15:10 GuilhemSempere

I am having this same issue.

It looks like clearOnEmpty is not being obeyed for some reason.

I did the following to replicate clearing the items,

$('select').selectpicker('deselectAll');
$('select').find('[value]').remove();
$('select').selectpicker('refresh');

Bitz avatar Jan 08 '20 21:01 Bitz

Our issues are different. I was only mentioning the lookup results under the divider line, not being removed after closing/re-opening the widget

Anyway... 4 years later, I finally spent some time on this problem and solved it this way:

	$('#VariantIds button.dropdown-toggle').on('click', function() {
		if ($('#VariantIds ul li.selected').length == 0)
			$('#VariantIds ul li').remove();
		else
			$('#VariantIds ul li:gt(0):not(.selected)').remove();
	});

(VariantIds is just a div wrapping the selectpicker)

GuilhemSempere avatar Nov 13 '23 13:11 GuilhemSempere