0
我目前使用jquery-ui-1.8.10 我正在使用自動完成組件,並且無法在文檔中找到任何方式來將其配置爲將超過10個結果返回給即使列表中有超過10個從服務器返回的結果。 http://jqueryui.com/demos/autocomplete/jQueryUI自動完成不會向用戶顯示超過10個結果
這是一個類似的帖子,但max對我不起作用,感覺就像他使用jQueryUI中自動完成的另一個組件,儘管他說他是。 jQuery autocomplete won't show more than 10 results
如何配置組件以向用戶顯示超過10個結果?
$("#module-name-search").autocomplete({
source: "service/searchForModule?langCode=" + langCode,
minLength: 3,
max: 50,
select: function(event, ui){
$("#module-code-search").val(ui.item.id);
$("#module-name-search").val(ui.item.text);
return false;
}
}).data("autocomplete")._renderItem = function(ul, item){
return $("<li></li>").data("item.autocomplete", item).append("<a style='font-size:9px;'>" + item.text + "</a>").appendTo(ul);
};
如果您不重寫_renderItem函數,它會工作嗎?如果將minLength設置爲0,那麼將JS控制檯拉起來並執行$(「#module-name-search」)。autocomplete。(「search」),你還看到只有10個結果嗎? – spike
我現在還沒有編碼,只能再次進入堆棧溢出。當有人回覆時,試着設置它給我發電子郵件。我確實發現了一個修補程序,它將搜索代碼併發布更新。 – avanderw