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

Blur fails to propagate to jQuery listener

Open mikeblum opened this issue 11 years ago • 2 comments
trafficstars

Listening on jQuery onBlur like this:

 this.$('select').on('blur', $.proxy(function(evt){
     this.$('select').data('combobox').hide();
 }, this));

change events work but blur fails until i added event triggers in the blur method like this:

, blur: function (e) {
            var that = this;
            this.focused = false;
            var val = this.$element.val();
            if (!this.selected && val !== '' ) {
                this.$element.val('');
                this.$source.val('').trigger('change');
                this.$target.val('').trigger('change');
            }
            if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);}
            //trigger a blur event
            this.$source.trigger('blur');
            this.$target.trigger('blur');
        }

mikeblum avatar Oct 29 '14 14:10 mikeblum

this causes clicking on an option to blur rather then set the value now.... I'll look to other ways to get blur to fire. Basically the problem is that clearing a field doesn't cause change to fire.

mikeblum avatar Oct 29 '14 14:10 mikeblum

Question: why does blur clear out the value if there is one?

, blur: function (e) {
            var that = this;
            this.focused = false;
           var val = this.$element.val();
            if (!this.selected && val !== '' ) {
                this.$element.val('');
                this.$source.val('').trigger('change');
                this.$target.val('').trigger('change');
            }
            if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);}
        }

mikeblum avatar Oct 29 '14 16:10 mikeblum