Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit number suggestions display in typeahead.js

Tags:

typeahead.js

As the title, I want to ask: "Is it possible to limit the suggestions displayed in typeahead?"

For example, I have 3 datasets, each dataset has 10000 results (from the query). And a subject started with character t is about 3000 results or may be more.

What will happened if I type t in the input ? 3000 result display or ... ?

Or is there any way to force user type specific characters then display suggestions ? (Like I must type tem, single character like t will not be accpeted)

like image 275
LCTG Avatar asked Jul 28 '13 20:07

LCTG


Video Answer


1 Answers

You should use a combination of limit and minLength. limit is the max number of suggestions that will be displayed for a given query (defaults to 5) and minLength is the minimum number of characters a query needs before suggestions start to get rendered (defaults to 0).

like image 153
jharding Avatar answered Sep 29 '22 10:09

jharding