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

Remove X when resetting via a form's reset button.

Open NHypothesis opened this issue 11 years ago • 4 comments
trafficstars

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.

NHypothesis avatar Aug 21 '14 20:08 NHypothesis

Just add: .combobox-container:not(.combobox-selected) .icon-remove, # for bsVersion: '2'

Before: .combobox-container:not(.combobox-selected) .glyphicon-remove {

On bootstrap-combobox.css

leompeters avatar Aug 28 '14 16:08 leompeters

I'm having the problem with Bootstrap v3. I tried adding that line anyway, but no such luck.

NHypothesis avatar Aug 29 '14 20:08 NHypothesis

alternative for :not(.combobox-selected) in IE8?

micheltlutz avatar Oct 01 '14 12:10 micheltlutz

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

mikeblum avatar Oct 29 '14 14:10 mikeblum