Autocomplete: changed the search function to always store the last term that was entered by the user. Fixed #5922 - autocomplete: Search not triggered if the first letter is the same as the first letter of a previous erased content

This commit is contained in:
Robson Braga Araujo 2010-08-11 07:02:50 +08:00 committed by Scott González
parent 04347e5a0d
commit 9a4eecdf85

View File

@ -229,6 +229,10 @@ $.widget( "ui.autocomplete", {
search: function( value, event ) { search: function( value, event ) {
value = value != null ? value : this.element.val(); value = value != null ? value : this.element.val();
// always save the actual value, not the one passed as an argument
this.term = this.element.val();
if ( value.length < this.options.minLength ) { if ( value.length < this.options.minLength ) {
return this.close( event ); return this.close( event );
} }
@ -242,10 +246,7 @@ $.widget( "ui.autocomplete", {
}, },
_search: function( value ) { _search: function( value ) {
this.term = this.element this.element.addClass( "ui-autocomplete-loading" );
.addClass( "ui-autocomplete-loading" )
// always save the actual value, not the one passed as an argument
.val();
this.source( { term: value }, this.response ); this.source( { term: value }, this.response );
}, },