Side Navigation - Unselectable Parent Items
SideNavigation with unselectable parent items.
Z2UI5_CL_SMPC_APP_172
Controls
sap.tnt
UI5 1.116
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_172- Source file
z2ui5_cl_smpc_app_172.clas.abap↗- Library
- sap.tnt
- UI5 entity
sap.tnt.SideNavigation- Demo kit sample
sap.tnt.sample.SideNavigationUnselectableParents- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.116
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: sidenavigation, side, navigation, sap.tnt, sidenavigationunselectableparents, vbox, button, navigationlist, navigationlistitem
Controls it builds
- sap.m.Button
- sap.m.VBox
- sap.tnt.NavigationList
- sap.tnt.NavigationListItem
- sap.tnt.SideNavigation
- 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_172.clas.abap — 129 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords sidenavigation side navigation sap.tnt sidenavigationunselectableparents vbox button navigationlist navigationlistitem
" @summary SideNavigation with unselectable parent items.
CLASS z2ui5_cl_smpc_app_172 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA expanded TYPE abap_bool.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_172 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_init( ).
expanded = abap_false.
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:tnt` v = `sap.tnt`
)->a( n = `height` v = `100%`
)->ele( `VBox`
)->a( n = `renderType` v = `Bare`
)->a( n = `alignItems` v = `Start`
)->a( n = `height` v = `100%`
)->tag( `Button`
)->a( n = `text` v = `Toggle Collapse/Expand`
)->a( n = `icon` v = `sap-icon://menu2`
)->a( n = `press` v = client->_event( `TOGGLE_EXPAND` )
)->ele( n = `SideNavigation` ns = `tnt`
)->a( n = `id` v = `sideNavigation`
)->a( n = `selectedKey` v = `walked`
)->a( n = `expanded` v = client->_bind( expanded )
)->a( n = `itemSelect` v = client->follow_up_action( val = client->cs_event-control_global
t_arg = VALUE #( ( `MESSAGE_TOAST` ) ( `show` ) ( `Item selected: {0}` ) ( `${$parameters>/item}.getText()` ) ) )
)->ele( n = `NavigationList` ns = `tnt`
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Building`
)->a( n = `icon` v = `sap-icon://building`
)->a( n = `selectable` v = `false`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Office 01`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Office 02`
)->end(
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Mileage`
)->a( n = `icon` v = `sap-icon://mileage`
)->a( n = `selectable` v = `false`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Driven`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Walked`
)->a( n = `id` v = `walked`
)->end(
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Transport`
)->a( n = `icon` v = `sap-icon://map-2`
)->a( n = `selectable` v = `false`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Flight`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Train`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Taxi`
)->end(
)->end(
)->ele( n = `fixedItem` ns = `tnt`
)->ele( n = `NavigationList` ns = `tnt`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Bar Chart`
)->a( n = `icon` v = `sap-icon://bar-chart`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `selectable` v = `false`
)->a( n = `href` v = `https://sap.com`
)->a( n = `target` v = `_blank`
)->a( n = `text` v = `External Link`
)->a( n = `icon` v = `sap-icon://attachment`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Compare`
)->a( n = `icon` v = `sap-icon://compare` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `TOGGLE_EXPAND`.
" original onCollapseExpandPress: toggles SideNavigation.expanded
expanded = xsdbool( expanded = abap_false ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.tnt
- Navigation List — Navigation List in a Page
- Side Navigation — SideNavigation in container with fixed width.
- Side Navigation - Tags — SideNavigation with tags for status indicators and metadata.
- ToolHeader — ToolHeader that mimics the content of the Shell.
- InfoLabel in DynamicPage — InfoLabel used as subheader in DynamicPage
- Tool Page with Vertical Navigation — A tool page layout with vertical navigation
- InfoLabel in Table — InfoLabel used in content of Table
- ToolHeader with IconTabHeader — ToolHeader can contain IconTabHeader. When both controls are combined, the IconTabHeader…
- Side Navigation - Press Event — SideNavigation with press event parameters and preventDefault.
- Side Navigation - Actions — SideNavigation with a quick create action button.
- Side Navigation - Wrapping of long texts — SideNavigation with long texts that wrap.
- Side Navigation - Overlay Mode — SideNavigation in a responsive popover.
On this page