我正在将typeahead.js与Bloodhound和远程数据集一起使用。我有一个“其他”选项,该选项应始终附加在自动完成中建议的末尾。我想使用“ add”方法添加此建议,但是未将其添加到结果列表中。
我该如何解决?我宁愿不要修改返回结果集的服务器端脚本。
var engine = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: scriptPath + '&q=%QUERY',
wildcard: '%QUERY'
},
});
// The following line is not working as it should.
// I have also tried specifying it as an option when creating the engine.
engine.add( [{ code: '9997', label: 'My school is not listed', city: '', state:'', size:'', nicknames:'' }] );