Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typeahead - Scrollable Dropdown Menu

Looks like the CSS isn't working for my Typeahead. I am trying to reproduce the Scrollable Dropdown Menu like on https://twitter.github.io/typeahead.js/examples

Here is my code:

JS

var productList = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('PART_NO'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            //Maybe I need a prefetch
           // prefetch: '../data/films/post_1960.json',
            remote: {
                url: 'getProducts/%QUERY',
                wildcard: '%QUERY'
            }
        });

        $('#scrollable-dropdown-menu .typeahead').typeahead(null, {
            name: 'PARTS',
            limit: 10,
            display: 'PART_NO',
            source: productList
        });

CSS

 #scrollable-dropdown-menu .tt-dropdown-menu {
            max-height: 150px;
            overflow-y: auto;
            background-color: red;
        }

I can't see where the .tt-dropdown-menu is?

Cheers,

Mick

like image 897
Mick Avatar asked Nov 06 '15 11:11

Mick


1 Answers

See this GitHub issue. There is an issue with the scrollable dropdown example.

Update your CSS to:

 #scrollable-dropdown-menu .tt-menu {
   max-height: 150px;
   overflow-y: auto;
   background-color: red;
 }
like image 116
David Brower Avatar answered Sep 20 '22 10:09

David Brower