slovak_100 slovak_100 - 6 months ago 39
Javascript Question

Google controls category filter

I have an issue with Google Controls filter. I want to know if it's possible to limit the values that appear in the dropdown to a particular number eg:2. At the moment I have a picklist with 100 values, and when I select the dropdown it extends my page and it does not look very pleasant -- I'd like to limit the values and then scroll through these values until I find the correct value.

I could not find anything on the google documentation and was hoping someone would be able to help me.

Please see the attached link: Codepen with example

As it stands the the picklist has 4 values, I'd like to limit it to only display two 2, and if more values appear, i'd like to be able to see these values via scroll functionality.

Thank you so much for your time, and any help is appreciated!

Answer

There does not seem to be a way to do it through google methods, but you certainly can try to add this to the css:

.charts-menu{
overflow-y:scroll;
height:40px;
}

Try playing around with height until you can only see the 2 items you want, the rest will be available though scroll. Hope it helps!