Autocomplete: search against label instead of value when both are provided.

Fixes #5237 - Array matching behaviour of autocomplete should match on label before value.

Thanks Simon Cusack.
This commit is contained in:
Scott González 2010-02-27 19:57:34 +00:00
parent d6fd76c0c1
commit 602576707e

View File

@ -152,7 +152,7 @@ $.widget( "ui.autocomplete", {
// escape regex characters
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
response( $.grep( array, function(value) {
return matcher.test( value.value || value.label || value );
return matcher.test( value.label || value.value || value );
}) );
};
} else if ( typeof this.options.source == "string" ) {