Closed achtan closed 9 years ago
@achtan try to invoke callback with all suggestions without filtering, also set data-min-length=0
to show drop-down on focus
i'm not sure if i know what u mean, but:
<input class="form-control typeahead search" name="search" type="text"
placeholder="NBA teams"
autocomplete="off" spellcheck="off"
data-source="suggestions"
data-selected="selected"
data-min-length=0
data-templates="suggestion"
data-value-key="name"/>
Template.searchFilter.helpers({
suggestions(query, sync, callback) {
callback(Template.instance().suggestionsResults.get());
}
});
i'm getting errors: on input focus: Uncaught TypeError: dataset.local is not a function on search: Uncaught TypeError: callback is not a function
with this helpers it works ok
Template.searchFilter.helpers({
suggestions() {
return Template.instance().suggestionsResults.get();
}
});
@achtan suggestions
function must take three arguments (query, sync, async)
and you need to call sync(Template.instance().suggestionsResults.get())
to pass suggestion to typeahead plugin
@achtan btw the sample when suggestions function has three arguments should work
@achtan please try to reproduce issue with uncought TypeError in demo app and send the sample code with repro
ok with sync() it works, but there is still one issue:
if i search for "f" i got zero results
if i search for "fo" i got results for "f" search
if i search for "foo" i got results for "fo" search
and so on... there is a one-step-delay
because my data Template.instance().suggestionsResults.get()
comms from server and the suggestions
helpers is called before the new data arrive (my guess)
@achtan try to useasync
as completion callback for Template.instance().suggestionsResults.get()
request
but async
is undefined in suggestions
helpers function
@achtan async
is last argument in your suggestions
helper function
i know, but as i said, 3rd argument of helpers function is undefined
@achtan it seems you use v0.10.x version where async
argument was second one
no i have: sergeyt:typeahead 0.11.1_1
@achtan I've added working example to demo app.
Hi, I filter my results by my own, can i somehow force typeahed to always show all results?