Bootstrap Typeahead not showing hints as expected

后端 未结 3 2045
青春惊慌失措
青春惊慌失措 2020-12-10 07:18

I\'m using Typeahead to show hints from an items database and a stores database. When I show hints only from items it shows fine, when I show only from stores works fine too

3条回答
  •  春和景丽
    2020-12-10 07:45

    Found the problem. It's a bug in typeahead.bundle.js (v 0.11.1). It's counting the number of rendered hints before appending them, so if the number of hints equals the limit it'll append an empty array.

    To prevent this I just switched lines 1723 and 1724 so it looks like this:

    that._append(query, suggestions.slice(0, that.limit - rendered));
    rendered += suggestions.length;
    

    Already reported the issue in typeahead's github.

提交回复
热议问题