bootstrap-combobox
bootstrap-combobox copied to clipboard
Remove X when resetting via a form's reset button.
The button to clear the combobox doesn't automatically change back to a carrot when the form is being reset. The change seems to be manipulated via a css pseudo-element, but I haven't had any luck fixing it programmatically.
Just add: .combobox-container:not(.combobox-selected) .icon-remove, # for bsVersion: '2'
Before: .combobox-container:not(.combobox-selected) .glyphicon-remove {
On bootstrap-combobox.css
I'm having the problem with Bootstrap v3. I tried adding that line anyway, but no such luck.
alternative for :not(.combobox-selected) in IE8?
We wanted to remove the X so that this plugin acts like a normal looking dropdown to avoid the extra click. for the time being this solution seems to work in BS3:
Change parse and select
, parse: function () {
var that = this
, map = {}
, source = []
, selected = false
, selectedValue = '';
this.$source.find('option').each(function() {
var option = $(this);
if (option.val() === '') {
that.options.placeholder = option.text();
return;
}
map[option.text()] = option.val();
source.push(option.text());
if (option.prop('selected')) {
selected = option.text();
selectedValue = option.val();
}
})
this.map = map;
if (selected) {
this.$element.val(selected);
this.$target.val(selectedValue);
//removing combobox-selected to stop the X from
//this.$container.addClass('combobox-selected');
this.selected = true;
}
return source;
}
, select: function () {
var val = this.$menu.find('.active').attr('data-value');
this.$element.val(this.updater(val)).trigger('change');
this.$target.val(this.map[val]).trigger('change');
this.$source.val(this.map[val]).trigger('change');
//removing combobox-selected to stop the X from
//this.$container.addClass('combobox-selected');
this.selected = true;
return this.hide();
}