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

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


onContextMenuItemClick

get onContextMenuItemClick(): Observable<any>

Returns

Observable<any>

Source

src/widgets.ts:1221


root

get root(): HTMLElement

Visual root

Returns

HTMLElement

Source

src/widgets.ts:1099

Methods

bind()

bind(element): Menu

Binds the menu to the specified options.element

Parameters

ParameterType
elementHTMLElement

Returns

Menu

Source

src/widgets.ts:1213


clear()

clear(): void

Removes all child menu items.

Returns

void

Source

src/widgets.ts:1122


click()

click(): void

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

Returns

void

Source

src/widgets.ts:1112


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


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


find()

find(text): Menu

Finds a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

Menu

Source

src/widgets.ts:1106


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


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


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


hide()

hide(): void

Returns

void

Source

src/widgets.ts:1208


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


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


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


remove()

remove(text): void

Removes a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

void

Source

src/widgets.ts:1117


separator()

separator(): Menu

Adds a separator line.

Returns

Menu

Source

src/widgets.ts:1198


show()

show(options?): Menu

Shows the menu.

Parameters

ParameterType
options?IShowMenuOptions

Returns

Menu

this menu itself.

Source

src/widgets.ts:1204


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


toString()

toString(): string

Returns

string

Source

src/widgets.ts:1225


create()

static create(): Menu

Creates a top menu.

Returns

Menu

Source

src/widgets.ts:1089


static popup(): Menu

Creates a popup menu.

Returns

Menu

Source

src/widgets.ts:1094