2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-26 14:56:36 +00:00

Fix autocomplete disable function

This commit is contained in:
fede 2013-08-30 12:58:26 +02:00
parent 98cbd94598
commit d65e4e0369
2 changed files with 22 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
/** /**
* Ajax Autocomplete for jQuery, version 1.2.7 * Ajax Autocomplete for jQuery, version 1.2.7
* (c) 2013 Tomas Kirda * (c) 2013 Tomas Kirda
* *
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/ * For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
* *
*/ */
/*jslint browser: true, white: true, plusplus: true */ /*jslint browser: true, white: true, plusplus: true */
/*global define, window, document, jQuery */ /*global define, window, document, jQuery */
@ -220,6 +220,7 @@
disable: function () { disable: function () {
this.disabled = true; this.disabled = true;
clearInterval(this.onChangeInterval);
if(this.currentRequest){ if(this.currentRequest){
this.currentRequest.abort(); this.currentRequest.abort();
} }
@ -288,7 +289,7 @@
onKeyPress: function (e) { onKeyPress: function (e) {
var that = this; var that = this;
console.log(that.disabled);
// If suggestions are hidden and user presses arrow down, display suggestions: // If suggestions are hidden and user presses arrow down, display suggestions:
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
that.suggest(); that.suggest();
@ -315,7 +316,7 @@
that.selectHint(); that.selectHint();
return; return;
} }
// Fall through to RETURN // Fall through to RETURN
case keys.RETURN: case keys.RETURN:
if (that.selectedIndex === -1) { if (that.selectedIndex === -1) {
that.hide(); that.hide();
@ -372,7 +373,6 @@
onValueChange: function () { onValueChange: function () {
var that = this, var that = this,
q; q;
if (that.selection) { if (that.selection) {
that.selection = null; that.selection = null;
(that.options.onInvalidateSelection || $.noop)(); (that.options.onInvalidateSelection || $.noop)();
@ -442,9 +442,9 @@
type: options.type, type: options.type,
dataType: options.dataType dataType: options.dataType
}).done(function (data) { }).done(function (data) {
that.processResponse(data, q); that.processResponse(data, q);
options.onSearchComplete.call(that.element, q); options.onSearchComplete.call(that.element, q);
}); });
} }
}, },