Skip to content

attempt of fixing #684 #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

elektronika-ba
Copy link
Contributor

Calling of options.onInvalidateSelection in onBlur timer if value has been changed.

Calling of `options.onInvalidateSelection` in onBlur timer.
@tkirda tkirda merged commit e5df065 into devbridge:master Feb 12, 2019
@netmou
Copy link

netmou commented Mar 13, 2019

      onBlur: function () {
            var that = this,
                options = that.options,
                value = that.el.val(),
                query = that.getQuery(value);

            // If user clicked on a suggestion, hide() will
            // be canceled, otherwise close suggestions
            that.blurTimeoutId = setTimeout(function () {
                that.hide();
// if selection is null auto pick a exact one is better
              if (that.selection == null) {
                    var is_matched = false;
                    for (var index in that.suggestions) {
                        var itVal = that.getValue(that.suggestions[index].value);
                        if (itVal == query) {
                            that.onSelect(index);
                            is_matched = true;
                            break;
                        }
                    }
                    if (!is_matched) { 
                      (options.onInvalidateSelection || $.noop).call(that.element);
                    }
                } else if (that.selection && that.currentValue !== query) {
                    (options.onInvalidateSelection || $.noop).call(that.element);
                }
            }, 200);
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants