I am using typeahead.js. I see no event handler that would let me capture the subset of my dataset suggested by a given query. Is there no way to get the actual subset of rows from my dataset?
You could use the typeahead:rendered
event. It passes all shown items as objects in the arguments
array. The event is fired immediately after the list of suggestions is shown ...
.on('typeahead:rendered', function() {
var array = [], i = 1;
for (i; i<arguments.length; i++) {
array.push(arguments[i].value)
}
console.log(array);
});
would console out ["Alaska", "Arkansas", "Illinois", "Kansas", "Louisiana"]
if the suggested items in the dropdown is Alaska, Arkansas, Illinois, Kansas, Louisiana
...
demo -> http://jsfiddle.net/kcjgr2rv/ (bear over with the lacking CSS)