According to jQuery examples you should do something like this:
$.widget( "custom.catcomplete", $.ui.autocomplete, { _create: function() { this._super(); this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" ); }, _renderMenu: function( ul, items ) { var that = this; $.each(items, function(key, value) { ul.append( "<li class='ui-autocomplete-category'>" + key + "</li>" ); $.each( items, function( index, item ) { var li = that._renderItemData( ul, item ); }); } } });
I do not test it. This is just an idea.
source share