Create Navigation Drawer in VBCS (Part1)
This is a multi-part blog wherein we will create a navigation drawer for WebApplication using VBCS.
As part of this blog, we will create a VBCS application with a hamburger icon in the ui header on whose click the navigation drawer will open or close.
- Create a sample app with multiple flows
- Define 2 custom events in testnavapp, these events will then be used by underlying page fragments to open/close navigation drawer and to route page flow based on the selection done.
Note: For newer application these events are created by default hence do this step only if you have an old application where you want to implement navigation drawer.
- Create/Edit the Header Fragment to add Navigation drawer icon on top.
Note: Header Fragment is created by default in newer applications, if it does not exist feel free to create a new one.
<header role="banner" class="oj-sm-flex-initial vb-web-applayout-header oj-sm-only-hide"><div class="oj-flex-bar oj-sm-align-items-center vb-web-applayout-header-content"><!-- Navigator toggle button --><div class="oj-flex-bar"><oj-button chroming="borderless"display="icons"><span slot="startIcon" class="oj-ux-ico-menu"></span><span><oj-bind-text value="Custom Navigation Drawer"></oj-bind-text></span></oj-button></div><!-- Company logo and application title only displayed in desktop mode --><div class="oj-flex-bar-middle oj-sm-margin-4x-horizontal oj-sm-align-items-center"><h1 class="oj-typography-body-md oj-typography-semi-bold" title="Application Name">My Custom Navigation App</h1></div></div></header>
- Now create a click event on the Navigation drawer button which will then invoke the custom event toggleDrawer.
- Navigate back to shell page and create an Event listener for the event toggleDrawer.
- Create below toggleDrawer function in shell page
- Call this function from the Action Chain of Custom Event handler for toggleDrawer Event
Comments
Post a Comment