$.udb.getMenu()
note
This article is about the getMenu() function of the $.udb object.
$.udb.getMenu()
Fetches a menu.
Returns a UdbPromise object.
Syntax
$.udb.getMenu( *options* )
*options* ::= {
[menuName]: *menu-name*,
[roles]: *roles*
}
Options is a struct that can have the following items, of which one of either must be specified.
Menu-name is a string that is the name of the menu. The menu returned is the menu that matches the given name.
roles is string containing a set of role names, concatenated with comma's (e.g. 'ROLE1,ROLE2'). These roles must exist and have a menu attached to them. The menu returned is the combined menu for these roles.
Examples
$.udb.getMenu({
menuName: menuName
})
.then(() => {
let struc = $.udb.menus.menu(menuName);
if (struc) {
//...
}
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});
$.udb.getMenu({
roles: 'ADMIN'
})
.then(() => {
//...
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});
Related events
| Event | Applies to | Occurs when |
|---|---|---|
| aftergetmenu | Page objects | After each .getMenu() action |
| beforegetmenu | Page objects | Before each .getMenu() action |