The customize-navbar extension allows you to add a top level menu to the navbar, add submenus underneath the top level menu, modify existing top level menu or submenu (text or link), or delete exiting top level menu (which will delete it's submenus) or submenu. This JavaScript code uses the Dojo Toolkit API; see online documentation for help.
The following shows an example customization where a menu and 2 submenu links have been added:
The main script calls the utility function waitFor() with these parameters:
-
Callback function - In here you'll find the examples of how to customize the nav bar menu. You don't have to do a create, modify, or delete all at once, i.e. comment out the code you don't need or modify the menu properties here. The examples are in one place to show how to use these menu functions to:
- create a top link menu, and/or submenu,
- modify a top link menu or single submenu, or
- delete a top link menu (and all it's submenus) or a single submenu
-
The HTML query selector,
div.lotusBanner
- This will wait for the navbar to finish rendering, by querying the HTML element
<div class='lotusBanner'>
if it exists, before proceeding to customize the navbar menu or submenu.
- This will wait for the navbar to finish rendering, by querying the HTML element
Below are details of the functions, parameters and descriptions of how they are used to create the menu:
Functions | Parameters | Description |
---|---|---|
createMenuWrapper |
|
Creates a top level menu on the navbar. The top level menu is also referred to as the menu wrapper or dropdown menu if there are submenus underneath or it can be a static menu. |
createSubMenu |
|
Creates a submenu underneath an existing top level menu. |
Below are details of the function, parameters and description of how it is used to modify the menu:
Functions | Parameters | Description |
---|---|---|
modifyMenu |
|
If you pass in just the queryTopNavMenu, this function will modify the top level menu properties (newText, newLink, newClass). If you pass in the queryTopNavMenu, and the querySubMenu, this function will query the top level menu by text, and it's submenu by text, and modify the submenu properties (newText, newLink, newClass). |
Below are details of the function, parameters and description of how it is used to delete the menu:
Functions | Parameters | Description |
---|---|---|
deleteMenu |
|
If you pass in just the queryTopNavMenu, this function will query and delete the top link menu by text and any subsequential submenu(s) underneath it. If you pass in the queryTopNavMenu, and the querySubMenu, this function will query the top level menu by text, and it's submenu by text, and delete just the submenu underneath it. |
Below are details of the function, parameters and descriptions of how it is used to wait for an HTML element to load:
Functions | Parameters | Description |
---|---|---|
waitFor |
|
This function is used to wait on a DOM element to render on a page before proceeding with your callback function. |
In order for Customizer to insert this customization:
- Put the custom JS file onto the MSP environment.
- Launch the appregistry UI at /appreg/apps URL (requires admin access).
- Create a New App definition.
- Go to the Code Editor section and remove the JSON outline.
- Paste in the content of the file customize-navbar.json file.
- If necessary, modify the include-files path and file name to match the location and name of the JS file on the MSP environment.
See section 2.5.1 Hosting the Custom JS / CSS Files of the main Connections Cloud Application Extension Migration documentation for more details about where to host the custom JS/CSS files.
Below are some common troubleshooting issues and how to potentially solve those issues and validate that the custom extension script is working properly. Additional console log statements can be added to the custom JS script to help with debugging.
Errors | Potential Solutions |
---|---|
Error couldn't find the node parent to insert menu wrapper | Check nodeParent parameter is not empty or check if the element dojo.query("ul.lotusInlinelist.lotusLinks")[0] exists. You can enter dojo.query(...) in the web browser development console. |
Cannot find top nav menu to modify | Check that the top nav menu with the <a arial-label='queryTopNavMenu'> exists to modify |
Cannot find top nav menu to delete | Check that the top nav menu with the <a arial-label='queryTopNavMenu'> exists to delete |