Grid List - Basic examples
A GridList with the default grid layout, resized live with a slider to show how the grid reflows.
Z2UI5_CL_SMPC_APP_111
Controls
sap.f
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_111- Source file
z2ui5_cl_smpc_app_111.clas.abap↗- Library
- sap.f
- UI5 entity
sap.f.GridList- Demo kit sample
sap.f.sample.GridListBasic- 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: gridlist, grid, list, sap.f, layout, slider, panel, toolbar, title, gridlistitem, vbox, flexitemdata
Controls it builds
- sap.f.GridList
- sap.f.GridListItem
- sap.m.FlexItemData
- sap.m.Label
- sap.m.Panel
- sap.m.Slider
- sap.m.Title
- sap.m.Toolbar
- sap.m.VBox
- sap.ui.core.mvc.View
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_111.clas.abap — 127 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords gridlist grid list sap.f layout slider panel toolbar title gridlistitem vbox flexitemdata
" @summary A GridList with the default grid layout, resized live with a slider to show how the grid reflows.
CLASS z2ui5_cl_smpc_app_111 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
TYPES: BEGIN OF ty_s_item,
title TYPE string,
subtitle TYPE string,
END OF ty_s_item.
DATA t_items TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY.
DATA slider_value TYPE i.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS model_init.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_111 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:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:f` v = `sap.f`
)->tag( `Slider`
)->a( n = `value` v = client->_bind( slider_value )
)->ele( `Panel`
)->a( n = `id` v = `panelForGridList`
)->a( n = `backgroundDesign` v = `Transparent`
" original onSliderMoved sets the panel width imperatively; here it is a roundtrip-free expression binding over the slider value
)->a( n = `width` v = |\{= ${ client->_bind( slider_value ) } + '%' \}|
)->ele( `headerToolbar`
)->ele( `Toolbar`
)->a( n = `height` v = `3rem`
)->tag( `Title`
)->a( n = `text` v = `GridList with default grid layout`
)->end(
)->end(
)->ele( n = `GridList` ns = `f`
)->a( n = `id` v = `gridList`
)->a( n = `headerText` v = `GridList header`
)->a( n = `items` v = client->_bind( t_items )
)->ele( n = `GridListItem` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->a( n = `shrinkFactor` v = `0`
)->end(
)->tag( `Title`
)->a( n = `text` v = `{TITLE}`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `{SUBTITLE}`
)->a( n = `wrapping` v = `true` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD model_init.
slider_value = 100.
t_items = VALUE #(
( title = `Grid item title 1` subtitle = `Subtitle 1` )
( title = `Grid item title 2` subtitle = `Subtitle 2` )
( title = `Grid item title 3` subtitle = `Subtitle 3` )
( title = `Grid item title 4` subtitle = `Subtitle 4` )
( title = `Grid item title 5` subtitle = `Subtitle 5` )
( title = `Grid item title 6 Grid item title Grid item title Grid item title Grid item title Grid item title` subtitle = `Subtitle 6` )
( title = `Very long Grid item title that should wrap 7` subtitle = `This is a long subtitle 7` )
( title = `Grid item title B 8` subtitle = `Subtitle 8` )
( title = `Grid item title B 9 Grid item title B Grid item title B 9 Grid item title B 9Grid item title B 9title B 9 Grid item title B 9Grid item title B` subtitle = `Subtitle 9` )
( title = `Grid item title B 10` subtitle = `Subtitle 10` )
( title = `Grid item title B 11` subtitle = `Subtitle 11` )
( title = `Grid item title B 12` subtitle = `Subtitle 12` )
( title = `Grid item title 13` subtitle = `Subtitle 13` )
( title = `Grid item title 14` subtitle = `Subtitle 14` )
( title = `Grid item title 15` subtitle = `Subtitle 15` )
( title = `Grid item title 16` subtitle = `Subtitle 16` )
( title = `Grid item title 17` subtitle = `Subtitle 17` )
( title = `Grid item title 18` subtitle = `Subtitle 18` )
( title = `Very long Grid item title that should wrap 19` subtitle = `This is a long subtitle 19` )
( title = `Grid item title B 20` subtitle = `Subtitle 20` )
( title = `Grid item title B 21` subtitle = `Subtitle 21` )
( title = `Grid item title B 22` subtitle = `Subtitle 22` )
( title = `Grid item title B 23` subtitle = `Subtitle 23` )
( title = `Grid item title B 24` subtitle = `Subtitle 24` )
( title = `Grid item title B 21` subtitle = `Subtitle 21` )
( title = `Grid item title B 22` subtitle = `Subtitle 22` )
( title = `Grid item title B 23` subtitle = `Subtitle 23` ) ).
ENDMETHOD.
ENDCLASS.
More in sap.f
- Shell Bar with title mega menu — Shell Bar example showing the control title as part of a mega menu, configurable by the a…
- Card Control — This sample illustrates how to specify the predefined header and the content of the Card…
- Grid List - Different Modes With Various Item Types — This is a sample for GridList with different modes of selection.
- Side Panel with single action item — Demonstrates the usage of Side Panel with single action item.
- Grid List with GridBoxLayout — This layout allows to display same height grid items with configurable width.
- Grid List - Drag and Drop — This sample represents GridList with enabled Drag and Drop functionality.
- Shell Bar with menu button — Shell Bar example with a menu button and a plain title.
- Product Switch with Navigation — This sample demonstrates the navigation behavior of Product Switch, configurable by the a…
- Semantic Page using Draft Indicator — This sample demonstrates the use of a DraftIndicator in the footer area.
- Grid Container — This sample represents the general usage of GridContainer.
- Dynamic Page Freestyle Example — Dynamic Page freestyle example with a responsive sap.m.Table in the content area, showing…
- Grid List features - Grouping, Header, Growing — This sample illustrates subgroups with headers, custom header and lazy loading of GridLis…
On this page