Skip to main content
Version: 10.1

$.udb.getMenu()

note

This article is about the getMenu() function of the udb object.

$.udb.getMenu()

Fetches a menu.

Returns a Promise object or the 'this' object. From USoft 10.0.1I, returns a udbPromise instead of a Promise object.

Syntax

.getMenu( *options* )

*options* ::= {
menuName: *menu-name*,
promise: *promise*,
success: *success-function*,
error: *error-function*
}

*menu-file* ::= { Menus.xml | }
*dir* ::= { ../xml/menus/ | }
*promise* ::= { true | false }

Options is a struct that can have the following items, all of which are optional.

Menu-name is a string that is the name of the menu.

Promise determines the return value of this function. If promise has the value 'true' (the default), a Promise object is returned. If promise has the value 'false', the ‘this’ object is returned instead.

Success-function is a function called after the operation has successfully completed.

Error-function is a function called if an error occurs.

Example

$.udb.getMenu({
menuName: menuName,
success: function() {
var struc = $.udb.menus.menu(menuName);
if (struc) {
...
}
}
});

In versions prior to USoft 10.0.1K, there were 2 additional settings in options corresponding to the Menu Directory and Menu File properties of menu controls. These properties have now been dropped.

dir: *menu-directory*,
menuFile: *menu-file*,

Menu-directory was a relative path to the directory where menu-file was located. This path was relative to the \WebSite directory. The default was '../xml/menus/'.

Menu-file was a string that was the name of the file containing the menu definition. The default was 'Menus.xml'.


EventApplies toOccurs when
aftergetmenuPage objectsAfter each .getMenu() action
beforegetmenuPage objectsBefore each .getMenu() action