Flex Box - Size Adjustments
Automatic size adjustments can be achieved for Flex Items with the use of Flex Item Data settings on the contained controls.
Z2UI5_CL_SMPC_APP_514
Controls
sap.m
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_514- Source file
z2ui5_cl_smpc_app_514.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.FlexBox- Demo kit sample
sap.m.sample.FlexBoxSizeAdjustments- 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: flexbox, flex, box, sap.m, flexboxsizeadjustments, html, vbox, panel, button, flexitemdata
Controls it builds
- sap.m.Button
- sap.m.FlexBox
- sap.m.FlexItemData
- sap.m.Panel
- sap.m.VBox
- sap.ui.core.HTML
- 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_514.clas.abap — 289 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords flexbox flex box sap.m flexboxsizeadjustments html vbox panel button flexitemdata
" @summary Automatic size adjustments can be achieved for Flex Items with the use of Flex Item Data settings on the contained controls.
CLASS z2ui5_cl_smpc_app_514 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_514 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF 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:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:core` v = `sap.ui.core`
" the sample's style.css, injected via a core:HTML content attribute (see
" CAPABILITIES.md) - the dashed flex-item frame and the zero-width variant.
" Literal braces are escaped \{ \} in a backtick literal
)->tag( n = `HTML` ns = `core`
)->a( n = `content` v = `<style>` &&
`.sapUiDemoFlexBoxSizeAdjustments .sapMFlexItem\{border:1px dashed #000; margin:0.1875rem; padding:0.1875rem\}` &&
`.sapUiDemoFlexBoxSizeAdjustmentsZeroWidthItems .sapMFlexItem\{width:0\}` &&
`</style>`
)->ele( `VBox`
)->ele( `Panel`
)->a( n = `headerText` v = `Equal flexibility and content`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustments`
)->ele( `FlexBox`
)->a( n = `alignItems` v = `Start`
)->ele( `Button`
)->a( n = `text` v = `1`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Emphasized`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `2`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Reject`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `3`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Accept`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->end(
)->end(
)->ele( `Panel`
)->a( n = `headerText` v = `Different flexibility, equal content`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustments`
)->ele( `FlexBox`
)->a( n = `alignItems` v = `Start`
)->ele( `Button`
)->a( n = `text` v = `1`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Emphasized`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `2`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Reject`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `2`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `3`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Accept`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `3`
)->end(
)->end(
)->end(
)->end(
)->ele( `Panel`
)->a( n = `headerText` v = `Equal flexibility, different content`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustments`
)->ele( `FlexBox`
)->a( n = `alignItems` v = `Start`
)->ele( `Button`
)->a( n = `text` v = `1`
)->a( n = `width` v = `50px`
)->a( n = `type` v = `Emphasized`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `2`
)->a( n = `width` v = `100px`
)->a( n = `type` v = `Reject`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `3`
)->a( n = `width` v = `150px`
)->a( n = `type` v = `Accept`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->end(
)->end(
)->ele( `Panel`
)->a( n = `headerText` v = `Equal flexibility, different content, width 0`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustments`
)->ele( `FlexBox`
)->a( n = `alignItems` v = `Start`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustmentsZeroWidthItems`
)->ele( `Button`
)->a( n = `text` v = `1`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Emphasized`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `2`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Reject`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `3`
)->a( n = `width` v = `100%`
)->a( n = `type` v = `Accept`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->end(
)->end(
)->ele( `Panel`
)->a( n = `headerText` v = `Different flexibility and content, width 0`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustments`
)->ele( `FlexBox`
)->a( n = `alignItems` v = `Start`
)->a( n = `class` v = `sapUiDemoFlexBoxSizeAdjustmentsZeroWidthItems`
)->ele( `Button`
)->a( n = `text` v = `1`
)->a( n = `width` v = `50px`
)->a( n = `type` v = `Emphasized`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `2`
)->a( n = `width` v = `100px`
)->a( n = `type` v = `Reject`
)->a( n = `class` v = `sapUiSmallMarginEnd`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `text` v = `3`
)->a( n = `width` v = `150px`
)->a( n = `type` v = `Accept`
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
).
client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.
More in sap.m
- List - Header & Info Toolbar — The 'headerText' property is an easy but limited way of setting the list header. If you n…
- Input - Suggestions - OSP — If you need to use an Open Search Provider (OSP) to supply possible values, you can do th…
- Input - Custom Value Help Icon — This example shows the usage of a custom value help icon instead of the default one.
- Select - Change Events — Demonstrates the use of 'change' and 'liveChange' events.
- MultiInput - Model update — This sample illustrates how the model bound to the MultiInput can be updated upon token c…
- Object Header Responsive II — This is a responsive Object Header with a Title, 2 Statuses/Attributes rendered below the…
- Input - Assisted — Assisted input is available via suggestions - shown as you type - and a value help dialog.
- Segmented Button in View Settings Dialog — Segmented Button used in View Settings Dialog component
- Launch Tile — Shows Launch Tile samples that can contain header, subheader, image content, unit, and a…
- Object Header – Active Attributes — Active Object Attributes can trigger actions, such as navigating to related content insid…
- MultiComboBox - Suggestions with Value State — MultiComboBox with suggestions and Value State Message containing a link.
- Notification List Group with lazy loading of the notifications — Notification List Group with lazy loading of the notifications.
On this page