-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using typeahead with "remote" option doesn't filter out drop down results #248
Comments
After thinking more on this i realized that it has to be responsibility of remote api to return filtered results, not the typeahead. Since i was using static json datasource my returned results are same every time for which one should use prefetch. So closing this issue. |
swapnil-mishra - could you post your 'template' - I'm trying to use the Handlebars engine as well, but seems to have some issues with my template layout. Thx! |
Below is my handlebars template
And the typeahead init code. Please note that you in case of Handlebars you need to put compiled template in typeahead template option. This is because of the fact the Handlebars doesn't have a render method so it doesn't adheres directly to typeahead templating engine requirements. // compile template from the above source
var source = $('#myTemplate').html();
var template = Handlebars.compile(source);
$('#typeahead').typeahead({
minLength: 3,
remote: {
url : 'someurl'
},
template: template,
engine: Handlebars
}); |
Thx swapnil-mishra - that helps!! |
Below is the code to init typeahead
this is my movies.json datasource
Now suppose i start typing out "ama" it doesn't filter out the other result item namely "@TRANSPORTER3". But if i change datasource type to prefetch instead of remote filtering works. Just wondering why its not filtering out results in case of remote.
Below are screenshots for same.
Prefetch
Remote
The text was updated successfully, but these errors were encountered: