MultiComboBox - maxPickerHeight
Limit the picker popup height using maxPickerHeight property
- Class
z2ui5_cl_smpc_app_495- Repository
- abap2UI5/samples-controls
- Ports
sap.m.sample.MultiComboBoxMaxPickerHeight- UI5 libraries
- sap.m, sap.ui.core, sap.ui.layout
- Lowest UI5 release
- 1.150
- In the browser
- Runs in the playground
- Controls it builds
- sap.m.Label, sap.m.MultiComboBox, sap.m.Page, sap.ui.core.Item, sap.ui.core.mvc.View, sap.ui.layout.VerticalLayout
The class
" @keywords multicombobox multi combo box sap.m multicomboboxmaxpickerheight verticallayout label item
" @summary Limit the picker popup height using maxPickerHeight property
" @origin sap.m.sample.MultiComboBoxMaxPickerHeight - https://sdk.openui5.org/entity/sap.m.MultiComboBox/sample/sap.m.sample.MultiComboBoxMaxPickerHeight (status: generated - machine-written, not yet reviewed)
CLASS z2ui5_cl_smpc_app_495 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
TYPES:
BEGIN OF ty_s_item,
key TYPE string,
text TYPE string,
END OF ty_s_item.
TYPES ty_t_item TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY.
DATA t_items TYPE ty_t_item.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS model_init.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_495 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_init( ).
model_init( ).
view_display( ).
ELSEIF client->check_on_navigated( ).
view_display( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `height` v = `100%`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->a( n = `xmlns:l` v = `sap.ui.layout`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns` v = `sap.m`
)->ele( `Page`
)->a( n = `showHeader` v = `false`
)->a( n = `class` v = `sapUiContentPadding`
)->ele( `content`
)->ele( n = `VerticalLayout` ns = `l`
)->tag( `Label`
)->a( n = `text` v = `MultiComboBox without maxPickerHeight`
)->a( n = `labelFor` v = `idMultiComboBoxDefault`
)->ele( `MultiComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idMultiComboBoxDefault`
)->a( n = `items` v = client->_bind( t_items )
)->tag( n = `Item` ns = `core`
)->a( n = `key` v = `{KEY}`
)->a( n = `text` v = `{TEXT}`
)->end(
)->tag( `Label`
)->a( n = `text` v = `MultiComboBox with maxPickerHeight='300px'`
)->a( n = `labelFor` v = `idMultiComboBox300px`
)->ele( `MultiComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idMultiComboBox300px`
)->a( n = `maxPickerHeight` v = `300px`
)->a( n = `items` v = client->_bind( t_items )
)->tag( n = `Item` ns = `core`
)->a( n = `key` v = `{KEY}`
)->a( n = `text` v = `{TEXT}`
)->end(
)->tag( `Label`
)->a( n = `text` v = `MultiComboBox with maxPickerHeight='15rem'`
)->a( n = `labelFor` v = `idMultiComboBox15rem`
)->ele( `MultiComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idMultiComboBox15rem`
)->a( n = `maxPickerHeight` v = `15rem`
)->a( n = `items` v = client->_bind( t_items )
)->tag( n = `Item` ns = `core`
)->a( n = `key` v = `{KEY}`
)->a( n = `text` v = `{TEXT}`
)->end(
)->tag( `Label`
)->a( n = `text` v = `MultiComboBox with maxPickerHeight='150px' and value state`
)->a( n = `labelFor` v = `idMultiComboBoxWithValueState`
)->ele( `MultiComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idMultiComboBoxWithValueState`
)->a( n = `maxPickerHeight` v = `150px`
)->a( n = `valueState` v = `Information`
)->a( n = `valueStateText` v = `The maxPickerHeight property limits the picker popup height. When items exceed this height, the picker becomes scrollable.`
)->a( n = `items` v = client->_bind( t_items )
)->tag( n = `Item` ns = `core`
)->a( n = `key` v = `{KEY}`
)->a( n = `text` v = `{TEXT}` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD model_init.
" onInit builds 100 items (key item<n>, text Item <n>) to make the picker scroll
DO 100 TIMES.
DATA(index) = sy-index.
INSERT VALUE #( key = |item{ index }| text = |Item { index }| ) INTO TABLE t_items.
ENDDO.
ENDMETHOD.
ENDCLASS.