enter code here
我試圖重現搜索建議中的Facebook。它顯示在不同'類型'與標題(個人,組,頁面,不同「類型」)的結果定製catcomplete犯規顯示結果時,包含多個類別
基本上我需要按類型對結果進行分組,並添加一個非可共享標題的名稱類型(例如:用戶,組);就像Facebook並:
這是jQuery UI的頁面定製catcomplete:
$.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);
});
}
});
CNC中
可以在這裏輸入 '集訓' 上serch主頁進行測試字段(不需要登錄):http:// 209.51.221.243/integracion/login.php(類型'deya'的作品,類型'bootcamp'不起作用
Wich is work荷蘭國際集團罰款時,只有一種類型的結果,但是當這個響應是不止一個,如:
[{"value":"Donde puedo descargar los drivers de bootcamp?","id":"1","category":"Ayudas"}][{"value":"Donde puedo descargar los drivers de bootcamp?","id":"1","category":"Ayudas"},{"first_name":"bootcamp","last_name":"bootcamp","id":"95","value":"bootcamp bootcamp","category":"Usuarios"}]
它不顯示任何ressult,爲什麼呢?
你的問題是什麼?你的代碼看起來不錯。什麼不工作? – Gavriel
就是這樣,它按預期工作。它會在自動完成列表中顯示返回的項目。我試圖添加一個頭,讓用戶知道netxt項是類型(例如:persones,組,頁面,..) –
所以你的問題是如何與CSS樣式呢? – Gavriel