jQuery UI自动完成 – that._renderItemData不是一个函数

我采用了jQuery UI Autocomplete的简单类别示例 ,并将其集成到我的应用程序中。 当我开始在搜索栏中输入内容时,我在Firebug中收到错误“TypeError:that._renderItemData不是函数”

我也有一个jQuery没有冲突。

jQuery(document).ready(function($) { $.widget( "custom.catcomplete", $.ui.autocomplete, { _renderMenu: function( ul, items ) { var that = this, currentCategory = ""; $.each( items, function( index, item ) { if ( item.category != currentCategory ) { ul.append( "
  • " + item.category + "
  • " ); currentCategory = item.category; } that._renderItemData( ul, item ); }); } }); $(function() { var data = [ { label: "anders", category: "" }, { label: "andreas", category: "" }, { label: "antal", category: "" }, { label: "annhhx10", category: "Products" }, { label: "annk K12", category: "Products" }, { label: "annttop C13", category: "Products" }, { label: "anders andersson", category: "People" }, { label: "andreas andersson", category: "People" }, { label: "andreas johnson", category: "People" } ]; $( "#search" ).catcomplete({ delay: 0, source: data }); });

    我认为这是因为冲突。 所以我尝试用这个替换var = this

      var that = $(this) 

     var that = jQuery(this) 

    但两种选择都抛出相同的错误。 如何解决这个冲突?

    类别是jQuery UI 1.9的新增function。 我有1.8.3。

    使用最新的1.9.2 jQuery JS解决了这个问题。