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
menu
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:
{JSEvent} event
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:
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:
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:
{Object} menuItemId The id to retrieve size for.
Returns: Dimension The size of the menu item.
getSubMenuItems(menuItemId)
Returns the sub menu items of the menu item with id 'menuItemId'
@public
Parameters:
{Object} menuItemId The unique identifier of the menu item whose sub-menu items are to be retrieved.
Returns: Array<CustomType<servoyextra-sidenav.MenuItem>> An array of sub-menu items for the specified menu item.
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 The unique identifier of the menu item to check.
Returns: Boolean Returns `true` if the specified menu item and all its ancestors are enabled. Returns `false` if the `menuItemId` cannot be found or if any ancestor of the menu item is not enabled.
isMenuItemExpanded(menuItemId)
Returns true if the menuItem is expanded.
@public
Parameters:
{Object} menuItemId The unique identifier of the menu item to check.
Returns: Boolean Returns `true` if the specified menu item is currently expanded, otherwise `false`.
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 The unique identifier of the menu item to be removed, including all its sub-menu items.
Returns: Boolean True if the menu item was successfully removed; false if the specified menuItemId could not be found.
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 The unique identifier of the menu item whose sub-menu items are to be removed.
Returns: Boolean True if the sub-menu items were successfully set; false if the specified menuItemId could not be found.
setMenuItemEnabled(menuItemId,enabled)
Enable or disable the menuItem Return false if menuItemId cannot be found.
@public
Parameters:
Returns: Boolean Returns `false` if the `menuItemId` cannot be found, otherwise `true` indicating the operation was successful.
setMenuItemExpanded(menuItemId,expanded,mustExecuteOnMenuItemExpand)
Force the menuItem to be expanded or collapsed. Return false if menuItemId cannot be found or is disabled.
@public
Parameters:
Returns: Boolean Returns `false` if the `menuItemId` cannot be found or is disabled, otherwise `true` indicating the operation was successful.
setRootMenuItems(menuItems)
Init the menu setting the root menuItems.
@public Example:
Parameters:
{Array<MenuItem>} menuItems Is an array of MenuItem objects. A MenuItem type is like this {{id: String|Number, text: String=, styleClass: String=, iconStyleClass: String=, enabled: Boolean=, data: Object=, menuItems: Array=, isDivider : Boolean=}} 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 The unique identifier of the menu item to select.
{Boolean} [mustExecuteOnMenuItemSelected] Force the onMenuItemSelect to be executed. Default false.
{Boolean} [mustExecuteOnMenuItemExpand] Force the onMenuItemExpand to be executed. Default false.
{Number} [level] Reduce the search to the selected menuItem at level, if any menuItem is selected at level.
Returns: Boolean Returns `true` if the menu item is successfully selected, otherwise `false` if the `id` cannot be found or the menu item is disabled.
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:
{Object} menuItemId
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:
Parameters:
{Object} menuItemId The unique identifier of the menu item to which the provided sub-menu items should be added.
{Array<MenuItem>} menuItems String|Number, text: String=, styleClass: String=, iconStyleClass: String=, enabled: Boolean=, data: Object=, menuItems: Array=, isDivider : Boolean=}>} 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 Returns `false` if the `menuItemId` cannot be found, otherwise `true` indicating the sub-menu items were successfully set.
Types
MenuItem
scripting type: CustomType<servoyextra-sidenav.MenuItem>
badgeStyleClass
Type: styleclass
Default Value: "badge text-bg-secondary"
badgeText
Type: tagstring
data
Type: object
enabled
Type: boolean
Default Value: true
formName
Type: form
iconStyleClass
Type: styleclass
id
Type: object
isDivider
Type: boolean
Default Value: false
menuItems
Type: MenuItem[]
relationName
Type: relation
styleClass
Type: styleclass
text
Type: tagstring
tooltip
Type: tagstring
Last updated
Was this helpful?