Adding Custom Menu Items
- 26 Jan 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Adding Custom Menu Items
- Updated on 26 Jan 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Follow these steps to remove standard menu items and add custom menu items/
Procedure
Retrieve and remove the standard sidebar menu items except for the login menu, add a
rootMenuItem
and configure the sidebar menu to open automatically when the app loads by running:// SidebarMenuModifier.ts export class SidebarMenuModifier { // ... constructor(private ivApi: ApiInterface) { const menuItems = this.ivApi.sidebarMenu.service.items; // Remove all entries besides the login one, and include the new nested one menuItems.splice(1, menuItems.length, this.rootMenuItem); // Automatically open the menu once finished modifying it ivApi.sidebarMenu.service.openMenu(); } }
Instantiate the
SidebarMenuModifier
in the main application fileindex.ts
by running:// index.ts // ... import {SidebarMenuModifier} from "./SidebarMenuModifier"; class TestApp { //.. getApi("https://iviondemo.iv.navvis.com/") .then((iv: ApiInterface) => { this.ivApi = iv; new SidebarMenuModifier(iv); }); } } // ..
Was this article helpful?