我注意到在官方文档中,它支持阿拉伯语,但我不确定它是否支持中文或其他非英语语言。我试过一些中文,韩文,甚至是阿拉伯语,但都没有用。
var predefined = new Bloodhound({
name: 'predefined',
// local: [{ name: 'gvc', typeaheadkind:'predefined'}, { name: 'meeting',typeaheadkind:'predefined' }, { name: 'huddle',typeaheadkind:'predefined' }],
local: data_list,
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
predefined.initialize();
var originalname = new Bloodhound({
name: 'originalname',
local: [{ name: 'الإنجليزية', typeaheadkind:'predefined'}, { name: '송지효',typeaheadkind:'predefined' }, { name: '特别的授业',typeaheadkind:'predefined' }],
// local: data_list,
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace
});
originalname.initialize();
var typeaheadoption =[
{
name: 'predefined',
displayKey: 'name',
source: predefined.ttAdapter()
},
{
name: 'originalname',
displayKey: 'name',
source: originalname.ttAdapter()
}
]
$('#searchbox').typeahead(null, typeaheadoption);