md-autocomplete no way to override width of droplist
It looks like the min-width style is applied directly to the open scroll droplist as 190px, is there a way for me to override it in my CSS and have a min-width: 500px?
https://github.com/angular/material/blob/9891723e327b32d9b2f2752114c021d35ae1de05/src/components/autocomplete/js/autocompleteController.js#L75-L100
I tried md-autocomplete { min-width: 890px !important; } autocomplete-custom-template { min-width: 890px !important; }
If you target the list item directly it should work fine... Assuming you've set the md-menu-class property on the md-autocomplete to "autocomplete-custom-template", then the following css should work:
.autocomplete-custom-template li { min-width: 890px; }
I don't think you would need the !important in this case, but I could be mistaken.
This is kind of a poor solution as users have different screen-sizes... I have done a hack where I calculate the current width of the input element and then set the class as a inline style.. this will not solve the issue when a user resize the window but for us that is somewhat ok ;)
+1 Would like to have more control over this. Same goes for height too.
If I'm not misstaken the height is based on the elements inside so setting a height on the item li should help.. how ever it looks like the number of items visible is somewhat "fixed" to about 2.5 items.. would be nice to set that to whatever fits our needs :)
Indeed, it's the number of items to view that I'd like to increase.
@UncleBenjen thanks! FYI your width fix works on 0.10.0. broken on 0.11.0
.autocomplete-custom-template li { min-width: 890px; }
+1 for ability to show more height too
You need to change selector. 0.11.0 is using the new virtual repeat directive
@mackelito Thanks Markus. What do I need to change? View source on the new virtual repeat still seems to use ul/li and has my custom class?
Just set the css to md-virtual-repeat-container element (or class)
md-virtual-repeat-container {
height: 300px;
}
While that does work, it affects ALL of my virtual repeats. (I use the md-virtual-repeater directly on my page as well)
Autocomplete appends a virtual repeat object to the bottom of the DOM with no unique id or class.
Is there a way to target just this virtual repeat? If not, could it be modified to inherit a class or attribute from autocomplete so we can target it?
I guess this is unique enough since my md-virtual-repeat-container does not have the autocomplete class. I hope this works for multiple autocompletes in the same DOM.
md-virtual-repeat-container.md-autocomplete-suggestions-container {}
THANK YOU very much for your help, feedback, and guidance. Do we want to close this ticket and open a new one for the height? I did try a very quick test on height and didn't see any difference.
You can close it. there are other issues regarding the height issue :)
for temporary solution using jquery or angular we can do like below $('.md-datepicker-input').attr('readonly', 'readonly');
The autocomplete results' width adjusts to the width of the md-autocomplete's containing md-input-container or equivalent; so I could adjust the autocomplete results' width by targeting .md-chip-input-container