.getMenu()

Previous Next

Fetches a menu.

Returns a Promise object or the 'this' object.

Syntax

.getMenu( options )

 

options     ::=  {

    menuName:  menu-name

,   menuFile:  menu-file

,   dir:  directory

,   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.

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

Directory is a relative path to the directory where menu-file is located. Directory is relative to the WebSite directory. The default is '../xml/menus/'.

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) {

            ...

        }

    }

});