Select - with icons
Illustrates the usage of a Select with icons
Z2UI5_CL_SMPC_APP_205
Controls
sap.m
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_205- Source file
z2ui5_cl_smpc_app_205.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.Select- Demo kit sample
sap.m.sample.SelectWithIcons- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.71 — the floor abap2UI5 holds its samples to
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: select, sap.m, selectwithicons, listitem
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_205.clas.abap — 91 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords select sap.m selectwithicons listitem
" @summary Illustrates the usage of a Select with icons
CLASS z2ui5_cl_smpc_app_205 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
TYPES:
BEGIN OF ty_s_product,
productid TYPE string,
name TYPE string,
icon TYPE string,
END OF ty_s_product.
DATA t_productcollection TYPE STANDARD TABLE OF ty_s_product WITH EMPTY KEY.
DATA selectedproduct TYPE string.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS model_init.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_205 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 = `xmlns` v = `sap.m`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `height` v = `100%`
)->ele( `Page`
)->a( n = `showHeader` v = `false`
)->a( n = `class` v = `sapUiContentPadding`
)->ele( `content`
)->ele( `Select`
)->a( n = `forceSelection` v = `false`
)->a( n = `selectedKey` v = client->_bind( selectedproduct )
)->a( n = `items` v = |\{ path: '{ client->_bind_path( t_productcollection ) }', sorter: \{ path: 'NAME' \} \}|
)->tag( n = `ListItem` ns = `core`
)->a( n = `key` v = `{PRODUCTID}`
)->a( n = `text` v = `{NAME}`
)->a( n = `icon` v = `{ICON}` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD model_init.
selectedproduct = `HT-1001`.
" inline mock from the sample's Page.controller.js (/ProductCollection)
t_productcollection = VALUE #(
( productid = `HT-1001` name = `Notebook Basic 17` icon = `sap-icon://paper-plane` )
( productid = `HT-1002` name = `Notebook Basic 18` icon = `sap-icon://add-document` )
( productid = `HT-1003` name = `Notebook Basic 19` icon = `sap-icon://doctor` )
( productid = `HT-1007` name = `ITelO Vault` icon = `sap-icon://sys-find-next` )
( productid = `HT-1010` name = `Notebook Professional 15` icon = `sap-icon://add-product` )
( productid = `HT-1011` name = `Notebook Professional 17` icon = `sap-icon://add-product` )
( productid = `HT-1020` name = `ITelO Vault Net` icon = `sap-icon://add-product` )
( productid = `HT-1021` name = `ITelO Vault SAT` icon = `sap-icon://add-product` )
( productid = `HT-1022` name = `Comfort Easy` icon = `sap-icon://add-product` )
( productid = `HT-1023` name = `Comfort Senior` icon = `sap-icon://add-product` ) ).
ENDMETHOD.
ENDCLASS.
More in sap.m
- Object List Item - markers aggregation — This sample shows the different states of an Object List Item, which can be set using the…
- ComboBox - Grouping of items — Items in the ComboBox could be grouped by a property
- Object Header - Condensed — The Object Header is shown in condensed mode with title, number, number unit and one attr…
- Standard List Item - Description — This list item offers a standardized user interface for list content with title and descr…
- Tokenizer in Toolbar and OverflowToolbar — Tokenizer integration with sap.m.OverflowToolbar
- Standard List Item - Info State Inverted — This sample demonstrates the inverted rendering behavior of the info text and the info st…
- Object Header - with Image — An Object Header will also make space for an image if one is specified, via a URL for the…
- List - Items Type — You can use the 'type' property of any list item, which inherits from ListItemBase contro…
- Standard List Item - Info — This list item offers a standardized user interface for list content with title and info.
- Object Header Responsive V — This is a responsive Object Header without a number and with a Title, 3 Statuses/Attribut…
- Table - Alternate Row Colors — Table with alternating light and dark background colors. Note: The effect of this feature…
- SelectList - with icons — A SelectList with icons.
On this page