【发布时间】:2014-07-21 19:31:38
【问题描述】:
我有下面的代码使用 Typeahead.js 来获得建议。我的代码没有大问题,因为它工作正常。
我面临的小问题是,在任何给定时间,即使来自远程 URL 的建议超过 5 条,我也只能看到 5 条建议。
var isearch = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: "http://localhost/search/get-data/%QUERY"
});
isearch.initialize();
$("#search_box .typeahead").typeahead(null,{ name: "isearch",
displayKey: "value",
source: isearch.ttAdapter(),
templates: {
suggestion: Handlebars.compile("{{value}}")
}
});
我期望的是有更多的建议,应该有一个滚动条供用户查看。
【问题讨论】:
标签: javascript jquery limit typeahead.js twitter-typeahead