Input - Suggestions - Dynamic
With the Input control's suggest event, you can handle the suggestionItems yourself dynamically.
Z2UI5_CL_SMPC_APP_473
Controls
sap.m
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_473- Source file
z2ui5_cl_smpc_app_473.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.Input- Demo kit sample
sap.m.sample.InputSuggestionsDynamic- 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: input, sap.m, inputsuggestionsdynamic, 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_473.clas.abap — 225 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords input sap.m inputsuggestionsdynamic verticallayout label item
" @summary With the Input control's suggest event, you can handle the suggestionItems yourself dynamically.
CLASS z2ui5_cl_smpc_app_473 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
TYPES: BEGIN OF ty_s_product,
name TYPE string,
END OF ty_s_product.
TYPES ty_t_product TYPE STANDARD TABLE OF ty_s_product WITH EMPTY KEY.
DATA t_products TYPE ty_t_product.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
METHODS model_init.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_473 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( ).
ELSEIF client->check_on_event( ).
on_event( ).
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:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:l` v = `sap.ui.layout`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->ele( n = `VerticalLayout` ns = `l`
)->a( n = `class` v = `sapUiContentPadding`
)->a( n = `width` v = `100%`
)->tag( `Label`
)->a( n = `text` v = `Product`
)->a( n = `labelFor` v = `productInput`
)->ele( `Input`
)->a( n = `id` v = `productInput`
)->a( n = `placeholder` v = `Enter product`
)->a( n = `showSuggestion` v = `true`
" onSuggest re-filters the suggestionItems binding with the typed term
)->a( n = `suggest` v = client->_event( val = `SUGGEST` arg = `${$parameters>/suggestValue}` )
)->a( n = `suggestionItems` v = client->_bind( t_products )
)->ele( `suggestionItems`
)->tag( n = `Item` ns = `core`
)->a( n = `text` v = `{NAME}` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `SUGGEST`.
" the original builds a StartsWith filter on Name (and an empty filter list
" for an empty term) and applies it to the suggestionItems BINDING - the
" same declarative filter, the model untouched
DATA(term) = client->get_event_arg( ).
client->follow_up_action( val = client->cs_event-binding_call
t_arg = VALUE #( ( `productInput` ) ( `suggestionItems` ) ( `filter` )
( `NAME` ) ( `StartsWith` ) ( term ) ) ).
ENDIF.
ENDMETHOD.
METHOD model_init.
" full mock /ProductCollection of ui5/mock/products.json (the bound field)
t_products = VALUE #(
( name = `Notebook Basic 15` )
( name = `Notebook Basic 17` )
( name = `Notebook Basic 18` )
( name = `Notebook Basic 19` )
( name = `ITelO Vault` )
( name = `Notebook Professional 15` )
( name = `Notebook Professional 17` )
( name = `ITelO Vault Net` )
( name = `ITelO Vault SAT` )
( name = `Comfort Easy` )
( name = `Comfort Senior` )
( name = `Ergo Screen E-I` )
( name = `Ergo Screen E-II` )
( name = `Ergo Screen E-III` )
( name = `Flat Basic` )
( name = `Flat Future` )
( name = `Flat XL` )
( name = `Laser Professional Eco` )
( name = `Laser Basic` )
( name = `Laser Allround` )
( name = `Ultra Jet Super Color` )
( name = `Ultra Jet Mobile` )
( name = `Ultra Jet Super Highspeed` )
( name = `Multi Print` )
( name = `Multi Color` )
( name = `Cordless Mouse` )
( name = `Speed Mouse` )
( name = `Track Mouse` )
( name = `Ergonomic Keyboard` )
( name = `Internet Keyboard` )
( name = `Media Keyboard` )
( name = `Mousepad` )
( name = `Ergo Mousepad` )
( name = `Designer Mousepad` )
( name = `Universal card reader` )
( name = `Proctra X` )
( name = `Gladiator MX` )
( name = `Hurricane GX` )
( name = `Hurricane GX/LN` )
( name = `Photo Scan` )
( name = `Power Scan` )
( name = `Jet Scan Professional` )
( name = `Jet Scan Professional` )
( name = `Copymaster` )
( name = `Surround Sound` )
( name = `Blaster Extreme` )
( name = `Sound Booster` )
( name = `Lovely Sound 5.1 Wireless` )
( name = `Lovely Sound 5.1` )
( name = `Lovely Sound Stereo` )
( name = `Smart Office` )
( name = `Smart Design` )
( name = `Smart Network` )
( name = `Smart Multimedia` )
( name = `Smart Games` )
( name = `Smart Internet Antivirus` )
( name = `Smart Firewall` )
( name = `Smart Money` )
( name = `PC Lock` )
( name = `Notebook Lock` )
( name = `Web cam reality` )
( name = `Screen clean` )
( name = `Fabric bag professional` )
( name = `Wireless DSL Router` )
( name = `Wireless DSL Router / Repeater` )
( name = `Wireless DSL Router / Repeater and Print Server` )
( name = `USB Stick` )
( name = `Travel Adapter` )
( name = `Cordless Bluetooth Keyboard, english international` )
( name = `Flat XXL` )
( name = `Pocket Mouse` )
( name = `PC Power Station` )
( name = `Astro Laptop 1516` )
( name = `Astro Phone 6` )
( name = `Benda Laptop 1408` )
( name = `Bending Screen 21HD` )
( name = `Broad Screen 22HD` )
( name = `Cerdik Phone 7` )
( name = `Cepat Tablet 10.5` )
( name = `Cepat Tablet 8` )
( name = `Server Basic` )
( name = `Server Professional` )
( name = `Server Power Pro` )
( name = `Family PC Basic` )
( name = `Family PC Pro` )
( name = `Gaming Monster` )
( name = `Gaming Monster Pro` )
( name = `7" Widescreen Portable DVD Player w MP3` )
( name = `10" Portable DVD player` )
( name = `Portable DVD Player with 9" LCD Monitor` )
( name = `CD/DVD case: 264 sleeves` )
( name = `Audio/Video Cable Kit - 4m` )
( name = `Removable CD/DVD Laser Labels` )
( name = `Beam Breaker B-1` )
( name = `Beam Breaker B-2` )
( name = `Beam Breaker B-3` )
( name = `Play Movie` )
( name = `Record Movie` )
( name = `ITelo MusicStick` )
( name = `ITelo Jog-Mate` )
( name = `Power Pro Player 40` )
( name = `Power Pro Player 80` )
( name = `Flat Watch HD32` )
( name = `Flat Watch HD37` )
( name = `Flat Watch HD41` )
( name = `Copperberry` )
( name = `Silverberry` )
( name = `Goldberry` )
( name = `Platinberry` )
( name = `ITelO FlexTop I4000` )
( name = `ITelO FlexTop I6300c` )
( name = `ITelO FlexTop I9100` )
( name = `ITelO FlexTop I9800` )
( name = `Smartphone Leather Case` )
( name = `Smartphone Alpha` )
( name = `Mini Tablet` )
( name = `Camcorder View` )
( name = `Tablet Pouch` )
( name = `Tablet Pouch` )
( name = `e-Book Reader ReadMe` )
( name = `Smartphone Beta` )
( name = `Maxi Tablet` )
( name = `Flyer` ) ).
ENDMETHOD.
ENDCLASS.
More in sap.m
- Icon Tab Bar - Overflow Behavior — In this example when there is not enough space for all tab items to fit on the screen, th…
- Icon Tab Bar - Start and End Overflow — This sample illustrates the start and end overflow mode of the Icon Tab Bar.
- Icon Tab Bar - Inline mode tab icons — This sample illustrates tab icons for inline mode.
- Standard List Item - Icon — This list item offers a standardized user interface for list content with title, descript…
- Combo box - Custom filtering "Contains" — You can override the default filtering "Starts with per term" with your own filter functi…
- Combo box - Custom filtering "Starts with" — You can override the default filtering "Starts with per term" with your own filter functi…
- Flex Box - Navigation Examples — Here is an example of how you can use navigation items as unordered list items in a Flex…
- ComboBox - Validation — The combo box control could be restricted to allow selection only from the items in the l…
- Object Header Responsive VI — A responsive Object Header whose intro and title are active links to sap.com, with a Curr…
- Header Container with Object Header — The Header Container combined with sap.m.ObjectHeader.
- MultiInput Custom Filtering — The default filtering for the suggestionItems aggregation uses is a 'starts with per term…
- Combo box - Search in both columns — Combo box dropdown list with search functionality which checks both columns. When you nee…
On this page