149
Views
2
Comments
Make dropdown width depending on content options
Question
Application Type
Reactive
Service Studio Version
11.14.16 (Build 60354)

Hello community,


I have a dropdown that can have text of different sizes.


I want the dropdown combo width to automatically expand depending on the size of the content.


Is that possible?


Thanks.



2022-07-12 16-41-57
Pedro Costa

Hi Salvador,

I developed an example application and you can do it using JavaScript.

Feel free to customize the javascript and css I had to add on the page so that the down arrow icon also moves as per the content (I believe this part should be improved) as I used a non-best practice (using !important to override the default width defined for the container)

Result:


I hope this solution is what you are looking for and will help you move forward with the development.

Regards,

Pedro Costa

AutoResizeSelectPureJS.oml
2022-07-12 16-41-57
Pedro Costa
AutoResizeSelectPureJS v2.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.