sidenav

(part of package 'Servoy Extra Components') Extends designtime/SolutionModel: JSWebComponent Extends runtime: RuntimeWebComponent

This is a reference page; many components have detailed usage guides here.

Properties

animate

Type: boolean Default Value: true


containedForm

Type: form


enabled

Type: enabled Default Value: true


footerForm

Type: form


headerForm

Type: form


iconCloseStyleClass

Type: styleclass Default Value: "fa fa-bars"


iconCollapseStyleClass

Type: styleclass Default Value: "fa fa-caret-down"


iconExpandStyleClass

Type: styleclass Default Value: "fa fa-caret-right"


iconOpenStyleClass

Type: styleclass Default Value: "fa fa-bars"


location

Type: point


Type: MenuItem[] Default Value: []


open

Type: boolean Default Value: true


relationName

Type: relation


responsiveHeight

Height of the container, set only in responsive forms.

Type: int Default Value: 0


scrollbarPosition

Type: string Default Value: "left"


servoyMenu

Type: JSMenu


sidenavWidth

Width of the container

Type: int Default Value: "300"


slideAnimation

Type: string Default Value: "slide-menu"


slidePosition

Type: string Default Value: "left"


styleClass

Type: styleclass


tabSeq

Type: tabseq


togglePosition

Type: string Default Value: "fixed-toggle"


visible

Type: visible


Events

onMenuItemCollapsed(menuItemId,event)

Parameters:


onMenuItemExpanded(menuItemId,event)

Parameters:


onMenuItemSelected(menuItemId,event)

@return {boolean}

Parameters:

Returns: {boolean}


onOpenToggled(event)

Parameters:


API

addMenuItem(menuItem,menuItemId,index)

Add a menu item. The menu is added as sub Menu Item if a menuItemId is provided, otherwise is added in root. If index is provided the menu is added at the specified index position, otherwise is added as last element. Return false if menuItemId cannot be found.

@public @param {String} [menuItem.iconStyleClass] use style classes to display icons as Font Icons, optional. example 'glyphicon glyphicon-search'. @param {Boolean} [menuItem.enabled] menuItem cannot be selected or expanded if disabled, optional. Default true. @param {Object} [menuItem.data] data object can be used to add custom properties to the menuItem, optional. For example you may set the formName to be shown when the menuItem is selected { formName: "aFormName", description: "This menu item will open the given form" } @param {Array} [menuItem.menuItems] an array of nested menuItems, optional. @param {Boolean} [menuItem.isDivider] if true render a divider into the menu instead of a menuItem, optional. All other properties are ignored. Default false. @param {String|Number} [menuItemId] add the item as subMenuItem of the menuItemId, optional. Default add the menuItem as root. @param {Number} [index] 0-based. The index at which to insert the item. Optional. Index value should not be greater then number of sibelings. Default is at the end. Example:

 var menuItem = {
 id: 100,
 text: "Sample Item #1",
 styleClass : "nav-large nav-primary",
 iconStyleClass:  "glyphicon glyphicon-search",
 data: { description: "This is sample information that can be added to a menuItem" },
 menuItems: [{
   id: 101,
   text: "Sub Item #1"
   }, {
   id: 102,
   text: "Sub Item #2"}]
 };
 elements.sideNavigation.addMenuItem(menuItem, 1, 0);

Parameters:

  • {MenuItem} menuItem MenuItem.id id uniquely identifies the menuItem in the menu object. Required

  • {object} [menuItemId] The menu text, optional, default is empty

  • {int} [index] Add style classes to the menuItem, optional,. Separate multiple value with a SPACE char. example 'nav-large nav-primary'.

Returns: boolean


clearMenuItems(depth)

Remove all the menu items. If depth is specified removes all the menu items at depth. If depth is equal to 1 all roots will be removed. Default depth is 1.

@public Example:

// clear the whole menu removing all nodes. 
elements.sidenav.clearMenuItems();

// clear menu at depth 2 removes the sub menu items of each root menu.
elements.sidenav.clearMenuItems(2);

Parameters:

  • {int} [depth] 1-based. Default 1.


getLocation(menuItemId)

Retrieves the screen location of a specific menu item. Returns the location as point (object with x and y properties).

Parameters:

  • {object} menuItemId NodeId the node to retrieve location for.

Returns: point Location of the menu item.


getMenuItem(menuItemId)

Returns the menuItem object

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: MenuItem


getParentMenuItem(menuItemId)

Returns the parent menuItem object of the menu item with id menuItemId

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: MenuItem


getRootMenuItems()

Returns the root menu object

@public

Returns: MenuItem[]


getSelectedMenuItem(level)

Returns the selected menuItem.

@public

Parameters:

  • {int} [level] If level is provided search for the selected menu item at level.

Returns: MenuItem


getSize(menuItemId)

Retrieves the size of a specific menu item. Returns the size as dimension (object with width and height properties).

Parameters:

  • {object} menuItemId NodeId the node to retrieve size for.

Returns: dimension Size of the menu item.


getSubMenuItems(menuItemId)

Returns the sub menu items of the menu item with id 'menuItemId'

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: MenuItem[]


isMenuItemEnabled(menuItemId)

Returns true if the menuItem and all it's ancestors are enabled. Return false if menuItemId cannot be found. *NOTE: The method returns false if any ancestor of the menuItem is not enabled; if the property enabled of the menuItem is set to true, but has a parent with the enabled property set to false, then isMenuItemEnabled returns false. *

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: boolean


isMenuItemExpanded(menuItemId)

Returns true if the menuItem is expanded.

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: boolean


removeMenuItem(menuItemId)

Remove the menu item and all it's subMenuItems from the tree. Return false if menuItemId cannot be found.

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: boolean


removeSubMenuItems(menuItemId)

Remove all the sub menu items of the menu item with id 'menuItemId' Return false if menuItemId cannot be found.

@public

Parameters:

  • {object} menuItemId MenuItemId

Returns: boolean


setMenuItemEnabled(menuItemId,enabled)

Enable or disable the menuItem Return false if menuItemId cannot be found.

@public

Parameters:

Returns: boolean


setMenuItemExpanded(menuItemId,expanded,mustExecuteOnMenuItemExpand)

Force the menuItem to be expanded or collapsed. Return false if menuItemId cannot be found or is disabled.

@public

Parameters:

  • {object} menuItemId MenuItemId

  • {boolean} expanded Expanded force the menuItem to expand if true, is collapsed otherwise

  • {boolean} [mustExecuteOnMenuItemExpand] Force the onMenuItemExpand to be executed. Default false.

Returns: boolean


setRootMenuItems(menuItems)

Init the menu setting the root menuItems.

@public Example:

var menu = [{
 id: 1,
 text: "Sample Item #1",
 styleClass : "sn-large",
 iconStyleClass:  "glyphicon glyphicon-search",
 data: { description: "This is sample information that can be added to a menuItem" },
 menuItems: [{
   id: 5,
   text: "Sub Item #1"
   }, {
   id: 6,
   text: "Sub Item #2"
 }]
 }, {
 id: 2,
 text: "Sample Item #2"
 },{
 isDivider: true
 },{
 id: 3,
 text: "Sample Item #3",
 enabled: false
 }];
 elements.sideNavigation.setRootMenuItems(menu);

Parameters:

  • {MenuItem[]} menuItems >} menuItems is an array of MenuItem objects. Each MenuItem object should set the required properties 'id', which uniquely identifies the menuItem object in menu, and 'text' property. The MenuItem may contain the optional properties 'styleClass', 'iconStyleClass', 'data', 'enabled', 'menuItems', 'isDivider'


setSelectedMenuItem(menuItemId,mustExecuteOnMenuItemSelected,mustExecuteOnMenuItemExpand,level)

Select the menu item with the given id. If level is provided search is optimized since it will search only within the descendant of the selected menuItem at level. For example if a root menuItem is selected and level is equal 2 search only in the subMenuItems of the selected root. Return false if menuItemId cannot be found or is disabled.

@public

Parameters:

  • {object} menuItemId Id

  • {boolean} [mustExecuteOnMenuItemSelected] Force the onMenuItemSelect to be executed. Default false.

  • {boolean} [mustExecuteOnMenuItemExpand] Force the onMenuItemExpand to be executed. Default false.

  • {int} [level] Reduce the search to the selected menuItem at level, if any menuItem is selected at level.

Returns: boolean


setSelectedMenuItemAsync(menuItemId)

@deprecated use setSelectedMenuItem(id, false, false) instead.

Select the menu item with the given id.

This function doesn't wait for a return value; use setSelectedMenuItem if you want to know if the menu item can be select successfully @public

Parameters:


setSubMenuItems(menuItemId,menuItems)

Set the menuItems as sub menu items of the menu item with id 'menuItemId' Return false if menuItemId cannot be found.

@public Example:

var menuItems = [{
 id: 10,
 text: "Sample Item #1",
 styleClass : "sn-large",
 iconStyleClass:  "glyphicon glyphicon-search",
 data: { description: "This is sample information that can be added to a menuItem" },
 menuItems: [{
   id: 12,
   text: "Sub Item #1"
   }
 }]
 }, {
 id: 11,
 text: "Sample Item #2"
 },{
 isDivider: true
 }];
 elements.sideNavigation.setSubMenuItems(menuItems);

Parameters:

  • {object} menuItemId MenuItemId

  • {MenuItem[]} menuItems >} menuItems is an array of MenuItem objects. Each MenuItem object should set the required properties 'id', which uniquely identifies the menuItem object in menu, and 'text' property. The MenuItem may contain the optional properties 'styleClass', 'iconStyleClass', 'data', 'enabled', 'menuItems', 'isDivider'.

Returns: boolean


Types

scripting type: CustomType<servoyextra-sidenav.MenuItem>


Last updated