cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select List max-width and width not working

davidsigleinit
Explorer
1,313

Hello all,

I'm currently having trouble with changing the width of the list that shows when opening a select field. The select has a width of 100% and spans the entire site, just as I want. But when I open the select and the list for it shows all items have a maximum width of 600px.

Changing the max-width or width properties does nothing to change the width of this list and it always stays at a width of 600px.

I'd be grateful if any of you have insight into why the list of the select behaves in such a way and how I can have the list have the same width as the select field.

Cheers

Accepted Solutions (1)

Accepted Solutions (1)

boghyon
Product and Topic Expert
Product and Topic Expert

Instead of manipulating the internal max-width* of the picker, set the `wrapItemsText` property of the control to true. From the sap.m.Select API reference:

> "Determines whether the text in the items wraps on multiple lines when the available width is not enough. When the text is truncated (wrapItemsText property is set to false), the max width of the SelectList is 600px. When wrapItemsText is set to true, SelectList takes all of the available width."

<Select xmlns="sap.m" wrapItemsText="true">

___

* Please note that "[..] HTML and CSS generated by SAPUI5 isn't part of the public API and may change in patch and minor releases. If you decide to override styles, you need to test and update your modifications each time SAPUI5 is updated. [...] SAP Fiori launchpad apps shouldn't override styles." (Source: Compatibility Rules - SAPUI5)

davidsigleinit
Explorer
0 Kudos

Thanks for taking the time to reply. Unfortunately your solution does not work for me. Either because I'm on an older version of SAPUI5 (1.71) or because of other reasons, like conflicting CSS. Either way your answer is probably the one that is more correct. Thanks!

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

davidsigleinit You can find the sap.m.Select sample with wrapItemsText="true" at https://sdk.openui5.org/entity/sap.m.Select/sample/sap.m.sample.SelectWithWrappedItemText/code

Answers (1)

Answers (1)

davidsigleinit
Explorer
0 Kudos

Found it myself after some more searching and it was this class that needs adjusting:

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Please note that "[..] HTML and CSS generated by SAPUI5 isn't part of the public API and may change in patch and minor releases. If you decide to override styles, you need to test and update your modifications each time SAPUI5 is updated. [...] SAP Fiori launchpad apps shouldn't override styles." (Source: Compatibility Rules - SAPUI5)