我已经获得了以下脚本。我注意到数据的获取工作完美(通过 console.log(响应)验证,准确显示了应该提取的内容)。但是,在显示的可能选项列表中,仅显示其中一些选项。有时候它们都是,有时是少数甚至没有。我无法看到其中的任何系统。
var users = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
//prefetch: { url: "/Worker/HintUser", cache: false, ttl: 15000 },
remote: {
wildcard: 'partial',
rateLimitWait: 100,
url: "/Worker/HintUser?input=partial",
transform: function (response) { console.log(response); return response; }
}
});
$("#remoteFetch").typeahead(
{ hint: true, highlight: true, minLength: 1 },
{ name: 'users', source: users });
我尝试过使用和跳过预取,而不是保留缓存等。始终使用相同的结果。我做错了什么?
我发现很多examples显示它是如何工作的,但我没有看到相关的区别。或者也许错过了一个很好的技巧。