Skip to content
Permalink
Browse files

Autocomplete: Split out logic for rendering individual items.

  • Loading branch information
scottgonzalez committed Feb 8, 2010
1 parent 1402650 commit 925bf9ec35905e260b7cfc7684de0c6465f91720
Showing with 10 additions and 5 deletions.
  1. +10 −5 ui/jquery.ui.autocomplete.js
@@ -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 );

0 comments on commit 925bf9e

Please sign in to comment.
You can’t perform that action at this time.