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: Array<CustomType<servoyextra-sidenav.MenuItem>> Default Value: []


open

Type: Boolean Default Value: true


relationName

Type: Relation


responsiveHeight

Height of the container, set only in responsive forms.

Type: Number Default Value: 0


scrollbarPosition

Type: String Default Value: "left"


servoyMenu

Type: JSMenu


sidenavWidth

Width of the container

Type: Number 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 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:

  • {CustomType<servoyextra-sidenav.MenuItem>} menuItem An array containing the menu item(s) to be added. Each menu item should include properties such as `id`, `text`, `styleClass`, `iconStyleClass`, `data`, and optionally `menuItems` for nested sub-menu items.

  • {Object} [menuItemId] Add the item as subMenuItem of the menuItemId. Default add the menuItem as root.

  • {Number} [index] 0-based. The index at which to insert the item. Index value should not be greater then number of sibelings. Default is at the end.

Returns: Boolean Returns `false` if the `menuItemId` cannot be found, otherwise `true` indicating the menu item was successfully added.


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:

  • {Number} [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 The node to retrieve location for.

Returns: Point The location of the menu item.


getMenuItem(menuItemId)

Returns the menuItem object

@public

Parameters:

  • {Object} menuItemId The unique identifier of the menu item to retrieve.

Returns: CustomType<servoyextra-sidenav.MenuItem> The menu item object corresponding to the specified `menuItemId`.


getParentMenuItem(menuItemId)

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

@public

Parameters:

  • {Object} menuItemId The unique identifier of the menu item whose parent menu item is to be retrieved.

Returns: CustomType<servoyextra-sidenav.MenuItem> The parent menu item object of the specified `menuItemId`.


getRootMenuItems()

Returns the root menu object

@public

Returns: Array<CustomType<servoyextra-sidenav.MenuItem>> An array of root menu item objects representing the top-level menu structure of the sidenav.


getSelectedMenuItem(level)

Returns the selected menuItem.

@public

Parameters:

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

Returns: CustomType<servoyextra-sidenav.MenuItem> The selected menu item object.


getSize(menuItemId)

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

Parameters: