Responsive Column Layout
Example of using ResponsiveColumnLayout.
Z2UI5_CL_SMPC_APP_348
Controls
sap.ui.layout
UI5 1.72
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_348- Source file
z2ui5_cl_smpc_app_348.clas.abap↗- Library
- sap.ui.layout
- UI5 entity
sap.ui.layout.cssgrid.CSSGrid- Demo kit sample
sap.ui.layout.sample.GridResponsiveColumnLayout- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.72
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: cssgrid, sap.ui.layout.cssgrid, gridresponsivecolumnlayout, togglebutton, slider, panel, toolbar, title, text, responsivecolumnlayout, card, responsivecolumnitemlayoutdata
Controls it builds
- sap.f.Card
- sap.m.Label
- sap.m.Panel
- sap.m.Slider
- sap.m.Text
- sap.m.Title
- sap.m.ToggleButton
- sap.m.Toolbar
- sap.m.VBox
- sap.ui.core.mvc.View
- sap.ui.layout.cssgrid.CSSGrid
- sap.ui.layout.cssgrid.ResponsiveColumnItemLayoutData
- sap.ui.layout.cssgrid.ResponsiveColumnLayout
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_348.clas.abap — 410 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords cssgrid sap.ui.layout.cssgrid gridresponsivecolumnlayout togglebutton slider panel toolbar title text responsivecolumnlayout card responsivecolumnitemlayoutdata
" @summary Example of using ResponsiveColumnLayout.
CLASS z2ui5_cl_smpc_app_348 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
" the width Slider - the Panel's width is an expression binding over it
DATA slider_value TYPE i.
" the sample's JSON model: the layout the ResponsiveColumnLayout reports
DATA currentbreakpoint TYPE string.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_348 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_init( ).
" the Slider's value="100"
slider_value = 100.
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( ).
" the ResponsiveColumnLayout demo with its eight f:Cards. The Panel width
" follows the Slider through an expression binding (roundtrip-free), and
" the layout's layoutChange carries its layout parameter to the backend so
" the "Current breakpoint" Text shows it, like the original's model write.
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:grid` v = `sap.ui.layout.cssgrid`
)->a( n = `xmlns:f` v = `sap.f`
)->a( n = `xmlns:cards` v = `sap.f.cards`
)->tag( `ToggleButton`
)->a( n = `id` v = `revealGrid`
)->a( n = `text` v = `Reveal Grid`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Slider`
)->a( n = `value` v = client->_bind( slider_value )
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->ele( `Panel`
)->a( n = `width` v = |\{= ${ client->_bind( slider_value ) } + '%'\}|
)->a( n = `id` v = `panelCSSGrid`
)->ele( `headerToolbar`
)->ele( `Toolbar`
)->a( n = `height` v = `3rem`
)->tag( `Title`
)->a( n = `text` v = `Grid with ResponsiveColumnLayout`
)->end(
)->end(
)->tag( `Text`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `text` v = `ResponsiveColumnLayout represents a layout which is configured to display a variable number of columns depending on available screen size.`
)->tag( `Text`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `text` v = `Grid row's height is dynamically determined by the height of the highest grid element on this row.`
)->tag( `Text`
)->a( n = `class` v = `sapUiSmallMarginBottom`
)->a( n = `text` v = |Current breakpoint: { client->_bind( currentbreakpoint ) }|
)->a( n = `width` v = `100%`
)->ele( n = `CSSGrid` ns = `grid`
)->a( n = `id` v = `grid1`
)->ele( n = `customLayout` ns = `grid`
)->tag( n = `ResponsiveColumnLayout` ns = `grid`
)->a( n = `layoutChange` v = client->_event( val = `LAYOUT_CHANGE` arg = `${$parameters>/layout}` )
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `4`
)->a( n = `rows` v = `4`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `4 / 4`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `3`
)->a( n = `rows` v = `3`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `3 / 3`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle Subtitle Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `1`
)->a( n = `rows` v = `1`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `1 / 1`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `1`
)->a( n = `rows` v = `1`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `1 / 1`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `1`
)->a( n = `rows` v = `1`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `1 / 1`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle `
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle `
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `3`
)->a( n = `rows` v = `2`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `3 / 2`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle Subtitle Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `1`
)->a( n = `rows` v = `1`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `1 / 1`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle Subtitle Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->ele( n = `Card` ns = `f`
)->ele( n = `layoutData` ns = `f`
)->tag( n = `ResponsiveColumnItemLayoutData` ns = `grid`
)->a( n = `columns` v = `1`
)->a( n = `rows` v = `1`
)->end(
)->ele( n = `content` ns = `f`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Title`
)->a( n = `text` v = `1 / 1`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle Subtitle Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->tag( `Label`
)->a( n = `text` v = `Subtitle`
)->a( n = `wrapping` v = `true`
)->end(
)->end(
)->end(
)->end(
)->end(
)->end( ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `LAYOUT_CHANGE`.
" onLayoutChange: setProperty('/currentBreakpoint', event layout)
currentbreakpoint = client->get_event_arg( ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.ui.layout
- Fullscreen – two groups using ColumnLayout with up to 4 columns — Form with two groups in a fullscreen app (with 2 columns in M, 3 columns in L, and 4 colu…
- Fix Flex - Fix container size — Shows a FixFlex control where fixContentSize is set to a specific value(200px) and sap.m…
- Splitter Layout - 2 non-resizable areas — Simple splitter example with two content areas that cannot be resized
- Splitter Layout - 3 areas — Simple splitter example with three content areas
- Block Layout with custom background color set per cell — Block Layout in which all cells use different background color set and different shade.
- Dynamic Side Content - position — The side content is positioned on the left side of the main content in left-to-right mode…
- Grid - Own properties — You can see how the different properties of the sap.ui.layout.Grid affect it's final appe…
- Automatic Sizing for Additional Rows and Columns — Example of setting gridAutoRows and gridAutoColumns properties.
- Grid Gap and Layout Data — Example of setting the gridGap property and using of Layout Data.
- Configuring Rows and Columns — Example of setting gridTemplateRows and gridTemplateColumns properties.
- Product Home Layout — Example of using several grids nested in one main grid with ResponsiveColumnLayout, in or…
- Splitter Layout — Splitter where you can change contentAreas and their sizes live
On this page