-
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
Allow remote to be a callback #8
Comments
I like this idea, what if we supported something like the this: $('.typeahead').typeahead({
name: 'remoteTest',
remote: {
url: 'http://example.com?q=%QUERY',
beforeSend: function(jqXhr, settings) {
// set headers
},
success: function(resp, status, jqXhr) {
// return nested data from response
}
}
}); Would that offer the flexibility you're looking for? |
+1 for this. I'd love to use this in SharePoint, but the JSON data I get back from its REST services are heavily nested, and I'd need to translate it to a dto to work with the data set expected format. |
I'm still wondering why the separation between local and remote. Can't we just create a datasource property, if it's a function it uses the contents of the return (possibly ajax) in all other cases it just uses the object. |
I hate to be annoying and revisit an old issue, but I am running into a similar issue and this doesn't quite address it. For my use case, I could really use a I'm using typeahead JS in a scenario where I have a remote data source that I must use to get some event listing data. However, the API's search feature is so screwed up that we're using LunrJS to handle all search client side. What I'd love to see is something along these lines:
In real life, you'd need to do a little more processing with the search results to get a list that was useful for typeaheadJS, but the fundamental thing is some way to support a function that returns a list in addition to a static list and a remote endpoint. (P.S. Thanks for the fantastic library. This thing is amazing!) |
I'm also wondering how to work around this issue in order to use Bloodhound prefetching etc. In my case, remote data comes from an API call with a Without Bloodhound, you can use a callback using the Am I missing something obvious? |
Was this resolved if so how do I access the nested data? |
If the remote returns something where the dataset is nested, you can't extract the dataset from it. It would also allow to customise the call to the backend if some extra headers were to be set.
The text was updated successfully, but these errors were encountered: