ComboBox - maxPickerHeight
Limit the picker popup height using maxPickerHeight property
Z2UI5_CL_SMPC_APP_494
Controls
sap.m
UI5 1.150
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_494- Source file
z2ui5_cl_smpc_app_494.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.ComboBox- Demo kit sample
sap.m.sample.ComboBoxMaxPickerHeight- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.150
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: combobox, combo, box, sap.m, comboboxmaxpickerheight, verticallayout, label, item
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_494.clas.abap — 133 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords combobox combo box sap.m comboboxmaxpickerheight verticallayout label item
" @summary Limit the picker popup height using maxPickerHeight property
CLASS z2ui5_cl_smpc_app_494 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_494 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 = `ComboBox without maxPickerHeight`
)->a( n = `labelFor` v = `idComboBoxDefault`
)->ele( `ComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idComboBoxDefault`
)->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 = `ComboBox with maxPickerHeight='300px'`
)->a( n = `labelFor` v = `idComboBox300px`
)->ele( `ComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idComboBox300px`
)->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 = `ComboBox with maxPickerHeight='15rem'`
)->a( n = `labelFor` v = `idComboBox15rem`
)->ele( `ComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idComboBox15rem`
)->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 = `ComboBox with maxPickerHeight='150px' and value state`
)->a( n = `labelFor` v = `idComboBoxWithValueState`
)->ele( `ComboBox`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `id` v = `idComboBoxWithValueState`
)->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.
More in sap.m
- Table - Item Navigated — This example demonstrates the navigated property of the item.
- Segmented Button in Dialog — Segmented Button used in Dialog component
- MultiComboBox — Choose one or more out of multiple options with the MultiComboBox control.
- MultiComboBox - Clear Icon — The multi combo box control can show 'clear' icon, which when pressed will remove the use…
- List - Grouping & Context Menu — Grouping your items makes it easier for the user to browse and find the desired content…
- Combo box - Deferred loading of the items — Use this feature to defer initialization of items until the point at which the items are…
- MultiComboBox - maxPickerHeight — Limit the picker popup height using maxPickerHeight property
- Tree - Lazy loading with a JSON model — Shows how lazy loading with a JSON model can be done using the toggleOpenState event.
- List - Swipe — With a swipe gesture you can show additional content for an item without having to naviga…
- List - Custom Actions — This example demonstrates how to add custom actions to list items. Dedicated 'Delete' and…
- List - Selection & Search — When searching a list with multi selection the previously selected items will stay select…
- MultiInput Validators — MultiInput uses validators to accept, decline and change tokens.
On this page