Last active
December 18, 2015 18:19
-
-
Save ronmichael/5825279 to your computer and use it in GitHub Desktop.
Extend jQuery UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add some functions (or override some functions) | |
// e.g. $(selector).autocomplete("doMore", data); | |
$.widget("ui.autocomplete", $.ui.autocomplete, { | |
doMore: function (data) { | |
// this = autocomplete object | |
// this.element = auto complete input element | |
}, | |
overRideBlur: function() { | |
this._on(this.element, { | |
blur: function (event) { | |
// the standard blur code | |
if (this.cancelBlur) { | |
delete this.cancelBlur; | |
return; | |
} | |
clearTimeout(this.searching); | |
this.close(event); | |
this._change(event); | |
// raise an extra event | |
$(this.element).trigger("autocompleteblur"); | |
} | |
}); | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.widget("ui.autocomplete", $.extend({}, $.ui.autocomplete.prototype, { | |
_search: function (value) { | |
this.pending++; | |
this.element.addClass("ui-autocomplete-loading"); | |
this.cancelSearch = false; | |
this.source({ term: value }, this._response()); | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment