Open carlosescri opened 11 years ago
Try it...
// Call the typeahead.
$('#searchname').typeahead({
ajax: {
url: 'index.php?option=com_bolsas&task=pessoas.getname&tmpl=component&format=json',
timeout: 300,
method: 'get',
triggerLength: 3,
displayField: 'name',
preDispatch: function (query) {
return {
nome: query
};
}
},
display: 'name',
val: 'id'
});
I don't know if this is correct but, when I configure an AJAX call to give results to Typeahead it is supposed that results are filtered. As typeahead searchs for the querystring in the results If one of them hasn't it then it is not displayed.
I know this is issue occurs because I'm using typeahead as a classic autocomplete, but I'm sure that other users are going to use it in the same way. I've fixed this in my results appending the field where the string was found, but it would be nice if we have an option for disabling filtering when using AJAX.
Cheers,
C.