My suggestion engine works fine, I just have a problem because when I click on item its json object appears in input element. I would like only OrgName to appear in input value.
<input class="form-control companySearch" type="text" value="" name="q" autocomplete="off" placeholder="Search a company">
var organization = new Bloodhound({
remote: {
url: '/search/org?term=%QUERY%',
wildcard: '%QUERY%'
},
datumTokenizer: Bloodhound.tokenizers.whitespace('term'),
queryTokenizer: Bloodhound.tokenizers.whitespace
});
$(".companySearch").typeahead({
hint: true,
highlight: true,
minLength: 1,
},
{
source: organization.ttAdapter(),
name: 'organizationsList',
templates: {
suggestion: function (data) {
return '<a class="list-group-item ">' + data.OrgName + ', '+ data.address.Address+ ', '+ data.address.city.City+ ', ' + data.address.city.country.Country + '</a>';
}
}
}
);