You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was needing this too; I had a dig around in the source and found a possible extension point.
This might be intended and is just undocumented; or they will implement something else in the future.
What you do is implement your own transport callback in the bloodhound remote options, then fire the error or success functions passed in by Bloodhound so that it can continue with the response.
In my example, I've just implemented what the default transport does (call Jquery ajax).
vartest=newBloodhound({remote: {transport: function(url,options,onSuccess,onError){// Here, maybe log that we're about to look up remote data.// Here's where you'd do your custom lookup; for this example, we'll just use Jquery ajax as Bloodhound does.$.ajax(url,options).done(done).fail(fail).always(always);functiondone(data,textStatus,request){// Don't forget to fire the callback for BloodhoundonSuccess(data);}functionfail(request,textStatus,errorThrown){// Don't forget the error callback for BloodhoundonError(errorThrown);}functionalways(){}}}});
Activity
DavidMoore commentedon Jul 31, 2014
Hi Kevin.
I was needing this too; I had a dig around in the source and found a possible extension point.
This might be intended and is just undocumented; or they will implement something else in the future.
What you do is implement your own transport callback in the bloodhound remote options, then fire the error or success functions passed in by Bloodhound so that it can continue with the response.
In my example, I've just implemented what the default transport does (call Jquery ajax).
DavidMoore commentedon Jul 31, 2014
I've actually gone ahead and updated the Bloodhound API docs with the above, and put in a pull request: #921
kevincox commentedon Jul 31, 2014
Thanks @DavidMoore that is exactly what I am looking for.
Add documentation for the transport option