Skip to main content

Menu

Menu (either top menu or popup menu). Top menu sample: https://public.datagrok.ai/js/samples/ui/menu Popup menu sample: https://public.datagrok.ai/js/samples/ui/popup-menu

Example

DG.Menu.popup()
.item('Show info', () => grok.shell.info('Info'))
.separator()
.items(['First', 'Second'], (s) => grok.shell.info(s))
.show();

Constructors

new Menu()

new Menu(dart): Menu

Parameters

ParameterType
dartany

Returns

Menu

Source

src/widgets.ts:927

Properties

PropertyTypeDefault value
_checkHTMLDivElement...
dartanyundefined

Accessors

onContextMenuItemClick

get onContextMenuItemClick(): Observable<any>

Returns

Observable<any>

Source

src/widgets.ts:1007


root

get root(): HTMLElement

Returns

HTMLElement

Source

src/widgets.ts:940

Methods

bind()

bind(element): Menu

Binds the menu to the specified options.element

Parameters

ParameterType
elementHTMLElement

Returns

Menu

Source

src/widgets.ts:999


clear()

clear(): void

Removes all child menu items.

Returns

void

Source

src/widgets.ts:959


click()

click(): void

Executes the onClick function for that menu item. Only works for items, not groups.

Returns

void

Source

src/widgets.ts:949


endGroup()

endGroup(): Menu

Ends a group of menu items and returns to the higher menu level.

Returns

Menu

Source

src/widgets.ts:970


find()

find(text): Menu

Finds a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

Menu

Source

src/widgets.ts:943


group()

group(text, order): Menu

Returns an existing menu group or adds a new group with the specified text.

Parameters

ParameterTypeDefault value
textstringundefined
ordernull | numbernull

Returns

Menu

Source

src/widgets.ts:964


item()

item(text, onClick, order, options): Menu

Adds a menu group with the specified text and handler.

Parameters

ParameterTypeDefault value
textstringundefined
onClick() => voidundefined
ordernull | numbernull
optionsnull | IMenuItemOptionsnull

Returns

Menu

Source

src/widgets.ts:975


items()

items<T>(items, onClick, options): Menu

For each item in items, adds a menu group with the specified text and handler.

Type parameters

Type parameterValue
Tany

Parameters

ParameterTypeDefault value
itemsT[]undefined
onClick(item) => voidundefined
optionsnull | IMenuItemsOptions<T>null

Returns

Menu

Source

src/widgets.ts:980


remove()

remove(text): void

Removes a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

void

Source

src/widgets.ts:954


separator()

separator(): Menu

Adds a separator line.

Returns

Menu

Source

src/widgets.ts:988


show()

show(options?): Menu

Shows the menu.

Parameters

ParameterType
options?IShowMenuOptions

Returns

Menu

Source

src/widgets.ts:994


toString()

toString(): string

Returns

string

Source

src/widgets.ts:1011


create()

static create(): Menu

Returns

Menu

Source

src/widgets.ts:931


static popup(): Menu

Creates a popup menu.

Returns

Menu

Source

src/widgets.ts:936