Search results

ContextMenuComponent

ContextMenuComponent represents the react ContextMenu Component.

<div id='target'>Right click / Touch hold to open the ContextMenu</div>
<ContextMenuComponent target='#target' items={menuItems} />

Properties

animationSettings

MenuAnimationSettingsModel

Specifies the animation settings for the sub menu open.

Defaults to { duration: 400, easing: ‘ease’, effect: ‘SlideDown’ }

cssClass

string

Defines class/multiple classes separated by a space in the Menu wrapper.

Defaults to

enablePersistence

boolean

Enable or disable persisting component’s state between page reloads.

Defaults to false

enableRtl

boolean

Enable or disable rendering component in right to left direction.

Defaults to false

filter

string

Specifies the filter selector for elements inside the target in that the context menu will be opened.

Defaults to

items

MenuItemModel[]

Specifies menu items with its properties which will be rendered as ContextMenu.

Defaults to []

locale

string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

Defaults to undefined

showItemOnClick

boolean

Specifies whether to show the sub menu or not on click. When set to true, the sub menu will open only on mouse click.

Defaults to false

target

string

Specifies target element selector in which the ContextMenu should be opened.

Defaults to

Methods

close

Closes the ContextMenu if it is opened.

Returns void

destroy

Destroys the widget.

Returns void

enableItems

This method is used to enable or disable the menu items in the Menu based on the items and enable argument.

Parameter Type Description
items string[] Text items that needs to be enabled/disabled.
enable (optional) boolean Set true/false to enable/disable the list items.
isUniqueId (optional) boolean Set true if it is a unique id.

Returns void

hideItems

This method is used to hide the menu items in the Menu based on the items text.

Returns void

insertAfter

It is used to insert the menu items after the specified menu item text.

Returns void

insertBefore

It is used to insert the menu items before the specified menu item text.

Parameter Type Description
items MenuItemModel[] Items that needs to be inserted.
text string Text item before that the element to be inserted.
isUniqueId (optional) boolean Set true if it is a unique id.

Returns void

open

This method is used to open the ContextMenu in specified position.

Parameter Type Description
top number To specify ContextMenu vertical positioning.
left number To specify ContextMenu horizontal positioning.
target (optional) HTMLElement To calculate z-index for ContextMenu based upon the specified target.

Returns void

removeItems

It is used to remove the menu items from the Menu based on the items text.

Returns void

showItems

This method is used to show the menu items in the Menu based on the items text.

Parameter Type Description
items string[] Text items that needs to be shown.
isUniqueId (optional) boolean Set true if it is a unique id.

Returns void

Events

beforeClose

EmitType<BeforeOpenCloseMenuEventArgs>

Triggers before closing the menu.

beforeItemRender

EmitType<MenuEventArgs>

Triggers while rendering each menu item.

beforeOpen

EmitType<BeforeOpenCloseMenuEventArgs>

Triggers before opening the menu item.

created

EmitType<Event>

Triggers once the component rendering is completed.

onClose

EmitType<OpenCloseMenuEventArgs>

Triggers while closing the menu.

onOpen

EmitType<OpenCloseMenuEventArgs>

Triggers while opening the menu item.

select

EmitType<MenuEventArgs>

Triggers while selecting menu item.