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
{{ message }}
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
Is it possible to get all fetched remote values in typeahead bind function.
var bankNames = new Bloodhound({
datumTokenizer: function (datum) {
return Bloodhound.tokenizers.whitespace(datum.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
remote: {
url: '/payments/bankwithdrawal/bankdetails?str=%QUERY,
prepare: function (query, settings) {
var encoded = query.toUnicode();
settings.url = settings.url.replace('%QUERY', encoded);
return settings;
}
}
});
bankNames.initialize();
// Initializing the typeahead
$('.typeahead').typeahead({
hint: true,
highlight: true, // Enable substring highlighting
minLength: 1 // Specify minimum characters required for showing result
},
{
name: 'bankname',
source: bankNames
}).bind('change blur', function () {
console.log(bankNames);
console.log(bankNames.index.datums);
});
It should give me all bankNames in bankNames.index.datums but it is giving me
Object {}
__proto__: Object
constructor: function Object()
hasOwnProperty: function hasOwnProperty()
isPrototypeOf: function isPrototypeOf()
propertyIsEnumerable: function propertyIsEnumerable()
toLocaleString: function toLocaleString()
toString: function toString()
valueOf: function valueOf()
__defineGetter__: function __defineGetter__()
__defineSetter__: function __defineSetter__()
__lookupGetter__: function __lookupGetter__()
__lookupSetter__: function __lookupSetter__()
get __proto__: function __proto__()
set __proto__: function __proto__()
I need all bankNames in bind function where I need to perform some action.
When I am printing in bind function console.log(bankNames) it should return me all fetched remote values.
Any help will highly appreciated.
The text was updated successfully, but these errors were encountered:
AnshulLonkar
changed the title
Bootstrap Typeahead get all fetched remote values in bind function.
Bootstrap Typeahead how to get all fetched remote values in bind function.
Jul 26, 2017
I got the solution with the help of transform which is a part of Bloodhound. When configuring remote option, the transform options is available.
transform – A function with the signature transform(response) that allows you to transform the remote response before the Bloodhound instance operates on it.
Is it possible to get all fetched remote values in typeahead bind function.
It should give me all bankNames in
bankNames.index.datums
but it is giving meI need all bankNames in bind function where I need to perform some action.
When I am printing in bind function
console.log(bankNames)
it should return me all fetched remote values.Any help will highly appreciated.
The text was updated successfully, but these errors were encountered: