I have strange problem with tokeninput...
$("[name='business_list']").tokenInput( {{businessList|raw}}, {
hintText: "{{ 'business.findBusiness'|trans }}",
noResultsText: "{{'no_results'|trans({},'app')|capitalize}}",
searchingText: "{{'searching'|trans({},'app')|capitalize}}",
prePopulate: {{businesses|raw}},
onReady: function(){
$("[name='business_list']").siblings(".token-input-list").find("#token-input-").focus();
},
onResult: function(items){
items.push({
value: "aaa",
label: "<span>aaa</span>"
})
console.log(items);
//return items;
}
});
And it works like this: For example when I type 'a' for the first time it shows 'No results' (but in the console log I can see that he found 7 objects). When I delete 'a' and type it again it works fine. But... when I will type for example 'z' it will be again the same. It shows 'no results' but I can see that it founds 4 objects and after deleting and typing again it shows them... Any ideas ?
It works fine without 'onResult' function but I want to add one object to any result but with this it doesn't work fine...