-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown autowidth doesn't auto-size in some cases #2973
Comments
I even have this problem with the dropdown initially visible. btw, I see this as a bug not an enhancement. |
I agree with @steigerm; this definitely looks like a bug. I see this with p-dropdown inside of a p-overlayPanel that isn't visible initially. |
any update on this. i'm having same problem. dropdown that is populated from web api / service call. If you select an item, the dropdown re-sizes correctly, but until then it is sized like the OP describes |
+1 i get a feeling I have to add [autoWidth]='false' in a lot of places... |
This issue also appears on Tabview. I solved it with lazy loading feature. There you add an ng-template tag. For further details check here |
Is there already an update or workaround for this? |
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
http://plnkr.co/edit/bbBtMXd7M4M6oHKgYy5a?p=preview
Current behavior
If a dropdown isn't visible at component initialization time, the autowidth feature doesn't size the dropdown properly. Instead, it has a width of 30px, since the 'select' element is detected as having a width of 0px. See dropdown.ts:updateDimension().
Expected behavior
A dropdown with autowidth enabled should have the correct size, even if it's not visible on initialization.
Minimal reproduction of the problem with instructions
http://plnkr.co/edit/bbBtMXd7M4M6oHKgYy5a?p=preview
What is the motivation / use case for changing the behavior?
We have a dropdown with dynamic contents that's located in a modal. Due to the dynamic content of the dropdown, we want the dropdown to auto re-size. Since the dropdown is in a modal it's not visible on initialization, it's only visible after the user causes the modal to open, so the dropdown doesn't get sized properly.
To work around this issue, I've added an event handler in my component to manually call
dropdown.updateDimensions()
on the modal's show event. It'd be nice if this workaround wasn't needed and the dropdown automatically resized when it became visible.Angular version: 4.0.0
PrimeNG version: 4.0.1
Browser: all
Language: all
The text was updated successfully, but these errors were encountered: