我正在根据文件中的分类例子,执行“平等倡议”。 我愿向地主增加成果数目,而不是展示“成果(3)”。 我知道,需要从这个例子中修改_____Menu的功能,但我对如何修改这一功能有疑虑。 任何帮助我走上正确道路都将受到高度赞赏。
Here is the example code from jQuery UI Autocomplete Categories demo:
<script>
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var self = this,
currentCategory = "";
$.each( items, function( index, item ) {
if ( item.category != currentCategory ) {
ul.append( "<li class= ui-autocomplete-category >" + item.category + "</li>" );
currentCategory = item.category;
}
self._renderItem( ul, item );
});
}
});
</script>
<script>
$(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
});
});
</script>
<div class="demo">
<label for="search">Search: </label>
<input id="search" />
</div>