2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 12:55:12 +00:00

Method 'clear' which is used to clear autocomplete's state was included. This method can be used when data source is changed.

This commit is contained in:
Gediminas Backevicius 2013-04-09 11:27:26 +03:00
parent 364fd6a1f0
commit 19f0e6b6c5
2 changed files with 8 additions and 2 deletions

View File

@ -29,7 +29,7 @@ The standard jquery.autocomplete.js file is around 2.7KB when minified via Closu
Useful when for example you need to fill list of coma separated values. Useful when for example you need to fill list of coma separated values.
* `zIndex`: 'z-index' for suggestions container. Default: `9999`. * `zIndex`: 'z-index' for suggestions container. Default: `9999`.
* `type`: Ajax request type to get suggestions. Default: `GET`. * `type`: Ajax request type to get suggestions. Default: `GET`.
* `noCache`: Boolean value indicating whether to cache suggestion results. Default `true`. * `noCache`: Boolean value indicating whether to cache suggestion results. Default `false`.
* `onSearchStart`: `function (query) {}` called before ajax request. `this` is bound to input element. * `onSearchStart`: `function (query) {}` called before ajax request. `this` is bound to input element.
* `onSearchComplete`: `function (query) {}` called after ajax response is processed. `this` is bound to input element. * `onSearchComplete`: `function (query) {}` called after ajax response is processed. `this` is bound to input element.
* `tabDisabled`: Default `false`. Set to true to leave the cursor in the input field after the user tabs to select a suggestion. * `tabDisabled`: Default `false`. Set to true to leave the cursor in the input field after the user tabs to select a suggestion.

View File

@ -226,6 +226,12 @@
this.badQueries = []; this.badQueries = [];
}, },
clear: function () {
this.clearCache();
this.currentValue = null;
this.suggestions = [];
},
disable: function () { disable: function () {
this.disabled = true; this.disabled = true;
}, },
@ -632,4 +638,4 @@
} }
}); });
}; };
})); }));