I use typeahead v0.11.1 to show the result, but it does not show the result, the result of which starts with the same result.
The result that I get from the database is the following:
Object { Id: 4, Title: "project manager", Description: "project manager", CompanyId: 1 } Object { Id: 6, Title: "Software Developer", Description: "Software Developer", CompanyId: 1 } Object { Id: 7, Title: ".NET Developer", Description: ".NET Developer", CompanyId: 1 } Object { Id: 10, Title: "Android Developer", Description: "Android Developer", CompanyId: 1 } Object { Id: 11, Title: "iOS Developer", Description: "iOS Developer", CompanyId: 1 } Object { Id: 13, Title: "Sr. Android Developer", Description: "Sr. Android Developer", CompanyId: 1 } Object { Id: 14, Title: "Sr. iOS Developer", Description: "Sr. iOS Developer", CompanyId: 1 }
The problem is that typeahead displays the whole result except
Sr. Android Developer Sr. Android Developer and Sr. iOS Developer Sr. iOS Developer
var position = new Bloodhound({ datumTokenizer: function (datum) { return Bloodhound.tokenizers.whitespace(datum.Title); }, queryTokenizer: Bloodhound.tokenizers.whitespace, //prefetch: '../data/films/post_1960.json', remote: { url: '/Search/Positions?query=%QUERY', wildcard: '%QUERY', filter:function (positionList) { // Map the remote source JSON array to a JavaScript object array return $.map(positionList, function (position) { console.log("position is:", position); return { Title: position.Title }; }); } } }); var promisepos=position.initialize(); promisepos.done(function(){}); $('#Position').typeahead({ minLength:1, highlight:true, hint:false },{ name: 'positionList', displayKey:'Title', source:position.ttAdapter(), templates:{ footer: "<div class='position-wrapper'><a class='ad-ps'><i class='fa fa-user-secret'></i> Add New Position</a></div>", notFound: function(){ var ps=$('#Position').val(); $('#PositionId').val(""); return "<div class='position-wrapper'><p>No Position found.</p><a class='ad-ps'><i class='fa fa-user-secret'></i> Add New Position</a></div>"; }, suggestion: Handlebars.compile('<div class="position-wrapper">'+ '<div class="poosition-info-wrapper">'+ '<span>{{Title}}</span>'+ '</div>'+ '</div>') } });