Navigation List
Navigation List in a Page
Z2UI5_CL_SMPC_APP_123
Controls
sap.tnt
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_123- Source file
z2ui5_cl_smpc_app_123.clas.abap↗- Library
- sap.tnt
- UI5 entity
sap.tnt.NavigationList- Demo kit sample
sap.tnt.sample.NavigationList- 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: navigationlist, navigation, list, sap.tnt, overflowtoolbar, button, navigationlistitem
Controls it builds
- sap.m.Button
- sap.m.OverflowToolbar
- sap.tnt.NavigationList
- sap.tnt.NavigationListItem
- 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_123.clas.abap — 142 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords navigationlist navigation list sap.tnt overflowtoolbar button navigationlistitem
" @summary Navigation List in a Page
CLASS z2ui5_cl_smpc_app_123 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA expanded TYPE abap_bool.
DATA sub3_visible 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_123 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_init( ).
expanded = abap_true.
sub3_visible = abap_true.
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( `OverflowToolbar`
)->tag( `Button`
)->a( n = `text` v = `Toggle Collapse/Expand`
)->a( n = `icon` v = `sap-icon://menu2`
)->a( n = `press` v = client->_event( `TOGGLE_EXPAND` )
)->tag( `Button`
)->a( n = `text` v = `Show/Hide SubItem 3`
)->a( n = `icon` v = `sap-icon://menu2`
)->a( n = `press` v = client->_event( `TOGGLE_SUB3` )
)->end(
)->ele( n = `NavigationList` ns = `tnt`
)->a( n = `id` v = `navigationList`
)->a( n = `width` v = `320px`
)->a( n = `selectedKey` v = `subItem3`
)->a( n = `expanded` v = client->_bind( expanded )
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Item 1`
)->a( n = `key` v = `rootItem1`
)->a( n = `icon` v = `sap-icon://employee`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 1`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 2`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 3`
)->a( n = `id` v = `subItemThree`
)->a( n = `key` v = `subItem3`
)->a( n = `visible` v = client->_bind( sub3_visible )
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 4`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Invisible Sub Item 5`
)->a( n = `visible` v = `false`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Invisible Sub Item 6`
)->a( n = `visible` v = `false`
)->end(
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Invisible Section`
)->a( n = `icon` v = `sap-icon://employee`
)->a( n = `visible` v = `false`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 1`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 2`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 3`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 4`
)->end(
)->ele( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Item 2`
)->a( n = `icon` v = `sap-icon://building`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 1`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 2`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 3`
)->tag( n = `NavigationListItem` ns = `tnt`
)->a( n = `text` v = `Sub Item 4` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
CASE client->get_event( ).
WHEN `TOGGLE_EXPAND`.
" original onCollapseExpandPress: getExpanded() -> setExpanded(!bExpanded)
expanded = xsdbool( expanded = abap_false ).
WHEN `TOGGLE_SUB3`.
" original onHideShowSubItemPress: toggles subItemThree visibility
sub3_visible = xsdbool( sub3_visible = abap_false ).
ENDCASE.
ENDMETHOD.
ENDCLASS.
More in sap.tnt
- InfoLabel — InfoLabel with all available color schemes
- 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
- Side Navigation - Unselectable Parent Items — SideNavigation with unselectable parent items.
- 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.
On this page