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:1086

Properties

PropertyTypeDefault value
_checkHTMLDivElement...
dartanyundefined

Accessors

closeOnClick

get closeOnClick(): boolean

Whether the menu closes when clicked.

set closeOnClick(value): void

Parameters

ParameterType
valueboolean

Returns

boolean

Source

src/widgets.ts:1104


onClose

get onClose(): Observable <EventData<any>>

Returns

Observable <EventData<any>>

Source

src/widgets.ts:1227


onContextMenuItemClick

get onContextMenuItemClick(): Observable<any>

Returns

Observable<any>

Source

src/widgets.ts:1223


root

get root(): HTMLElement

Visual root

Returns

HTMLElement

Source

src/widgets.ts:1101

Methods

bind()

bind(element): Menu

Binds the menu to the specified options.element

Parameters

ParameterType
elementHTMLElement

Returns

Menu

Source

src/widgets.ts:1215


clear()

clear(): void

Removes all child menu items.

Returns

void

Source

src/widgets.ts:1124


click()

click(): void

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

Returns

void

Source

src/widgets.ts:1114


colorPalette()

colorPalette(colors, options?): Menu

Adds color palettes colors to menu.

Parameters

ParameterTypeDescription
colorsnumber[][]Array of arrays of color choices.
options?IMenuColorPaletteOptionsOptional params and functions, see IMenuColorPaletteOptions.

Returns

Menu

this menu itself.

Source

src/widgets.ts:1155


endGroup()

endGroup(): Menu

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

Returns

Menu

this menu itself.

Source

src/widgets.ts:1135


find()

find(text): Menu

Finds a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

Menu

Source

src/widgets.ts:1108


fontEditor()

fontEditor(initial, options?): Menu

Adds font editor to menu.

Parameters

ParameterTypeDescription
initialstringInitial font to be set first or reset.
options?IMenuFontEditorOptionsOptional params and functions, see IMenuFontEditorOptions.

Returns

Menu

this menu itself.

Source

src/widgets.ts:1164


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:1129


header(text, options?): Menu

Adds a header title.

Parameters

ParameterTypeDescription
textstringHeader title text.
options?IMenuHeaderOptionsOptional params and functions, see IMenuHeaderOptions.

Returns

Menu

this menu itself.

Source

src/widgets.ts:1194


hide()

hide(): void

Returns

void

Source

src/widgets.ts:1210


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:1140


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:1145


multiColumnSelector()

multiColumnSelector(dataFrame, options?): Menu

Adds multi-column selector to menu.

Parameters

ParameterTypeDescription
dataFrameDataFrameData frame to be used for the selector,where column choices are taken from.
options?IMenuMultiColumnSelectorOptionsOptional params and functions, see IMenuMultiColumnSelectorOptions.

Returns

Menu

this menu itself.

Source

src/widgets.ts:1184


remove()

remove(text): void

Removes a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

void

Source

src/widgets.ts:1119


separator()

separator(): Menu

Adds a separator line.

Returns

Menu

Source

src/widgets.ts:1200


show()

show(options?): Menu

Shows the menu.

Parameters

ParameterType
options?IShowMenuOptions

Returns

Menu

this menu itself.

Source

src/widgets.ts:1206


singleColumnSelector()

singleColumnSelector(dataFrame, options?): Menu

Adds single-column selector to menu.

Parameters

ParameterTypeDescription
dataFrameDataFrameData frame to be used for the selector,where column choices are taken from.
options?IMenuSingleColumnSelectorOptionsOptional params and functions, see IMenuSingleColumnSelectorOptions.

Returns

Menu

this menu itself.

Source

src/widgets.ts:1173


toString()

toString(): string

Returns

string

Source

src/widgets.ts:1229


create()

static create(): Menu

Creates a top menu.

Returns

Menu

Source

src/widgets.ts:1091


static popup(): Menu

Creates a popup menu.

Returns

Menu

Source

src/widgets.ts:1096