JSMenu

Properties Summarized

TypeNameSummary

The menu name (identifier)

Set/Get the menu space separated styleclases

Methods Summarized

TypeNameSummary

Adds a new menu item, as last item in the list.

Adds a new menu item, at a specific position.

Gets a menu item by identifier.

Gets a menu item by identifier.

Gets a menu item by index (0 based).

Returns all the menus items, either created at design time or at runtime, in the order they will show up in user interface.

Removes a menu item from children's list, returns true if element was found an removed

Removes a menu item with given id, returns true if element was found an removed

void

Selects a menu item in user interface

Properties Detailed

name

The menu name (identifier)

Type String the name (identifier) of the menu

styleClass

Set/Get the menu space separated styleclases

Type String

Sample

menu.styleClass = 'myclass';

Methods Detailed

addMenuItem(id)

Adds a new menu item, as last item in the list.

Parameters

  • String id the menu item identifier

Returns: JSMenuItem

Sample

var item = menu.addMenuItem('item1');

addMenuItem(id, index)

Adds a new menu item, at a specific position.

Parameters

  • String id the menu item identifier

  • Number index the index position in list (0 based)

Returns: JSMenuItem

Sample

var mnu = menu.addMenuItem('item1',0);

findMenuItem(id)

Gets a menu item by identifier. Also searches for nested elements. Returns null if not found.

Parameters

  • String id the menu item identifier

Returns: JSMenuItem

Sample

var mnu = menu.findMenuItem('item1');

getMenuItem(id)

Gets a menu item by identifier. Returns null if not found.

Parameters

  • String id the menu item identifier

Returns: JSMenuItem

Sample

var mnu = menu.getMenuItem('item1');

getMenuItemAt(index)

Gets a menu item by index (0 based). Returns null if not found.

Parameters

  • Number index the menu item index among its sibblings

Returns: JSMenuItem

Sample

var mnu = menu.getMenuItemAt(0);

getMenuItems()

Returns all the menus items, either created at design time or at runtime, in the order they will show up in user interface.

Returns: Array

Sample

var items = menu.getMenuItems();

getSelectedItem()

Returns: JSMenuItem the selectedItem

removeMenuItem(menuItem)

Removes a menu item from children's list, returns true if element was found an removed

Parameters

Returns: Boolean

Sample

var success = menu.removeMenuItem(item);

removeMenuItem(id)

Removes a menu item with given id, returns true if element was found an removed

Parameters

  • String id the menu item identifier

Returns: Boolean

Sample

var success = menu.removeMenuItem('item1');

selectMenuItem(menuItem)

Selects a menu item in user interface

Parameters

Returns: void

Sample

menu.selectMenuItem(item);

Last updated