1
我能够使用旧版本的Typeahead,没有问题,我对新版本的了解是有限的,而且我对于为什么会出现重复的条目感到困惑。Twitter Typeahead - 重复的AJAX建议
这是我的javascript:
// Sources
var sources = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '/sources/prefetch/',
remote: '/sources/prefetch/'
});
sources.initialize();
$('#a_sources_list').typeahead(null, {
name: 'sources',
displayKey: 'name',
source: sources.ttAdapter()
})
/来源/预取/回报:
[{"id":"1","name":"Google"},{"id":"3","name":"Yahoo"}]
这里是正在发生的截图:
如果我初始化我警犬实例与本地而非预取功能或遥控器,我会永远dupDetector被称为? –
我不知道,我会把一个console.log中,并找出。 –
谢谢你的建议。我认为问题是我没有使用远程或预取。 https://github.com/twitter/typeahead.js/issues/606#issuecomment-51221195 –