Dynamic Menu Items
Sidebar menu items can be loaded dynamically from your website using the Median Javascript Bridge. The new menu items can be loaded on specific pages or subsequent to events such as a user login flow. A default menu can be defined in the app configuration that is then overwritten dynamically as required. Or alternatively, the configuration can be left blank and all menus set by the website.
โ๏ธMedian JavaScript Bridge
To set the example sidebar navigation menu options run the command below.
Theenabled
parameter is required to activate the sidebar if it is hidden.
Thepersist
parameter is used to keep the changes after your app is closed and reloaded.var items = [{ label: "Google", url: "https://google.com", icon: "fas fa-cog" // optional Font Awesome icon }, { label: "Sample Grouping", isGrouping: true, subLinks: [{ label: "Apple", url: "https://apple.com", icon: "fas fa-home" // optional }, { label: "Google", url: "https://google.com", icon: "fas fa-home" //optional }] }, { label: "Sample Javascript", url: "javascript:alert('test')" }]; median.sidebar.setItems({"items":items,"enabled":true, "persist":true});
Updated 9 months ago
Next Steps