javascript - Typeahead always shows only 5 suggestions maximum -


i have below code using typeahead.js suggestions. have no major issues on code works fine.

the minor issue face given time, see 5 suggestions though there more 5 suggestions remote url.

var isearch = new bloodhound({     datumtokenizer: function(d) {           return bloodhound.tokenizers.whitespace(d.value);      },     querytokenizer: bloodhound.tokenizers.whitespace,     remote: "http://localhost/search/get-data/%query" });  isearch.initialize();    $("#search_box .typeahead").typeahead(null,{ name: "isearch",     displaykey: "value",     source: isearch.ttadapter(),     templates: {          suggestion: handlebars.compile("{{value}}")     } }); 

what expect there more suggestions, there should scroll bar users see.

this answer typeahead version 0.10.4.

the bloodhound suggestion engine has default value of 5 "limit" option (i.e. the max number of suggestions return bloodhound#get)

you can increase limit specifying desired value when instantiate bloodhound object. example, specify limit of 10:

var isearch = new bloodhound({  datumtokenizer: function(d) {       return bloodhound.tokenizers.whitespace(d.value);   },  querytokenizer: bloodhound.tokenizers.whitespace,  remote: "http://localhost/search/get-data/%query",  limit: 10 }); 

an example of instance of typeahead limit set 10 can found here:

http://jsfiddle.net/fresh/w03a28h9/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -