mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Autocomplete: Split out logic for rendering individual items.
This commit is contained in:
parent
1402650134
commit
925bf9ec35
15
ui/jquery.ui.autocomplete.js
vendored
15
ui/jquery.ui.autocomplete.js
vendored
@ -235,12 +235,10 @@ $.widget( "ui.autocomplete", {
|
||||
},
|
||||
|
||||
_suggest: function( items ) {
|
||||
var ul = this.menu.element.empty();
|
||||
var self = this,
|
||||
ul = this.menu.element.empty();
|
||||
$.each( items, function( index, item ) {
|
||||
$( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.appendTo( ul );
|
||||
self._renderItem( ul, item );
|
||||
});
|
||||
this.menu.refresh();
|
||||
this.menu.element.show();
|
||||
@ -249,6 +247,13 @@ $.widget( "ui.autocomplete", {
|
||||
}
|
||||
},
|
||||
|
||||
_renderItem: function( ul, item) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.appendTo( ul );
|
||||
},
|
||||
|
||||
_move: function( direction, event ) {
|
||||
if ( !this.menu.element.is(":visible") ) {
|
||||
this.search( null, event );
|
||||
|
Loading…
Reference in New Issue
Block a user