Jquery typeahead.js返回“;“空白”;数据集

Jquery typeahead.js返回“;“空白”;数据集,jquery,autocomplete,typeahead.js,Jquery,Autocomplete,Typeahead.js,我有点担心推特返回的结果是空白的,而官方的文档也没有帮助 我期待什么: <div class="tt-suggestion tt-selectable">Warcraft II: Tides of Darkness</div> ... var gameTitles= new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Blo

我有点担心推特返回的结果是空白的,而官方的文档也没有帮助

我期待什么:

<div class="tt-suggestion tt-selectable">Warcraft II: Tides of Darkness</div>
...
var gameTitles= new Bloodhound({
  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  remote: {
    url: '../api/autocomplete/%QUERY',
    wildcard: '%QUERY'
  }
});

$('#title').typeahead({minLength: 3}, {
  name: 'game-titles',
  display: 'value',
  source: gameTitles
});
作为参考,远程返回以下内容,以便我确定我的查询是否正确传递

[
  "Warcraft II: Tides of Darkness",
  "Warcraft II: Beyond the Dark Portal",
  "Warcraft III: Reign of Chaos",
  "Warcraft II: The Dark Saga",
  "Peggle: World of Warcraft Edition",
  "Warcraft III: Reforged Spoils of War Edition",
  "World of Warcraft",
  "Warcraft III: Reforged",
  "Warcraft: Orcs & Humans",
  "World of Warcraft: Legion"
]

Typeahead在数组中查找对象,默认情况下,如果建议在这些对象中查找
,可以通过将希望使用的属性名称指定给
显示
属性来更改

$('#title').typeahead({}, {
  name: 'game-titles',
  display: 'WHATEVER PROPERTY YOU WISH DISPLAYED',
  source: gameTitles
});
此外,不再维护typeAhead,selectize.js似乎是一个不错的选择

$('#title').typeahead({}, {
  name: 'game-titles',
  display: 'WHATEVER PROPERTY YOU WISH DISPLAYED',
  source: gameTitles
});