material icon indicating copy to clipboard operation
material copied to clipboard

md-autocomplete should allow custom result height

Open kuhnroyal opened this issue 11 years ago • 19 comments

Currently I can't find a way to target a specific md-autocomplete-suggestions-container/md-virtual-repeat-container in order to set a custom height for the result list.

md-autocomplete should set the md-menu-class or something else on the container so it can be targeted by CSS rules.

kuhnroyal avatar Oct 13 '15 13:10 kuhnroyal

Maybe it would be better to add support for md-auto-shrink & md-auto-shrink-min parameters directly on md-autocomplete directive. I will check how md-autocomplete communicates with md-virtual-repeat-container and will try to submit a PR for this.

ghost avatar Oct 13 '15 16:10 ghost

FYI, you are correct, I couldn't find a way to set height.... but for reference, this ticket is how you can set WIDTH

https://github.com/angular/material/issues/4772

elubin avatar Oct 22 '15 20:10 elubin

Exactly what I'm looking for. The hardcoded height limit to only show up-to 5 items is really limiting. Any update on potential release date or a work-around?

kiakj avatar Jan 12 '16 06:01 kiakj

+1

jaszczakBartosz avatar Jan 15 '16 09:01 jaszczakBartosz

+1

sroyqci avatar Jan 27 '16 15:01 sroyqci

+1

oreyan avatar Feb 25 '16 09:02 oreyan

+1

macdosi avatar Feb 25 '16 09:02 macdosi

+1

gabguy avatar Feb 25 '16 15:02 gabguy

As a workaround I am able to resize the suggestion box by overriding the CSS:

.md-virtual-repeat-container.md-autocomplete-suggestions-container {
    height: 420px;
    max-height: 420px !important;
}

ghost avatar Feb 26 '16 21:02 ghost

@muhengseow Yes, but that only works if you have just one of those.

kuhnroyal avatar Feb 27 '16 11:02 kuhnroyal

+1

Fl4m3Ph03n1x avatar Jun 06 '16 15:06 Fl4m3Ph03n1x

+1

Andrew-Gee avatar Jul 05 '16 11:07 Andrew-Gee

This makes the solution from @muhengseow slightly more generic, if you want a 'full height' solution.

.md-virtual-repeat-container.md-autocomplete-suggestions-container {
    position: fixed;
    bottom: 50px !important;
    height: initial !important;
    max-height: 99999999px !important;
}

Andrew-Gee avatar Jul 05 '16 12:07 Andrew-Gee

But this will be applicable for all the autocomplete inside the application. Can we write some kind of wrapper class on top of this

e.g. .custom-app-wrapper .md-virtual-repeat-container.md-autocomplete-suggestions-container { position: fixed; bottom: 50px !important; height: initial !important; max-height: 99999999px !important; }

I tried it but somehow the generated List is not generated inside the same element, it is a virtual list somewhere at bottom of DOM tree.

Can anybody suggest any way to achieve this ?

maheshk172 avatar Jul 19 '16 09:07 maheshk172

+1

celeguz avatar Aug 17 '16 17:08 celeguz

+1

askucher avatar Aug 20 '16 00:08 askucher

+1

begemott avatar Jan 05 '17 15:01 begemott

I was using Gimmeaphatbeat solution, but found that the drop down no longer displayed if there wasn't enough space at the bottom for the full height.

I would also like a solution like maheshk172's

ed4becky avatar Feb 21 '17 21:02 ed4becky

ADD md-dropdown-items The default is 5. md-dropdown-items = "7"

rodrigo-martins avatar Jul 11 '17 22:07 rodrigo-martins