Skip to main content

Menu

Defined in: js-api/src/widgets/menu.ts:38

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

Example​

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

Constructors​

Constructor​

new Menu(dart): Menu

Defined in: js-api/src/widgets/menu.ts:42

Parameters​

ParameterType
dartany

Returns​

Menu

Properties​

PropertyTypeDefined in
_checkHTMLDivElementjs-api/src/widgets/menu.ts:40
dartanyjs-api/src/widgets/menu.ts:39

Accessors​

closeOnClick​

Get Signature​

get closeOnClick(): boolean

Defined in: js-api/src/widgets/menu.ts:60

Whether the menu closes when clicked.

Returns​

boolean

Set Signature​

set closeOnClick(value): void

Defined in: js-api/src/widgets/menu.ts:61

Parameters​
ParameterType
valueboolean
Returns​

void


onClose​

Get Signature​

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

Defined in: js-api/src/widgets/menu.ts:185

Fires when the menu closes.

Returns​

Observable<EventData<any>>


onContextMenuItemClick​

Get Signature​

get onContextMenuItemClick(): Observable<any>

Defined in: js-api/src/widgets/menu.ts:180

Fires when an item of this menu is clicked.

Returns​

Observable<any>


root​

Get Signature​

get root(): HTMLElement

Defined in: js-api/src/widgets/menu.ts:57

Visual root

Returns​

HTMLElement

Methods​

bind()​

bind(element): Menu

Defined in: js-api/src/widgets/menu.ts:171

Binds the menu to the specified options.element

Parameters​

ParameterType
elementHTMLElement

Returns​

Menu


clear()​

clear(): void

Defined in: js-api/src/widgets/menu.ts:80

Removes all child menu items.

Returns​

void


click()​

click(): void

Defined in: js-api/src/widgets/menu.ts:70

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

Returns​

void


colorPalette()​

colorPalette(colors, options?): Menu

Defined in: js-api/src/widgets/menu.ts:111

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.


endGroup()​

endGroup(): Menu

Defined in: js-api/src/widgets/menu.ts:91

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

Returns​

Menu

this menu itself.


find()​

find(text): Menu

Defined in: js-api/src/widgets/menu.ts:64

Finds a child menu item with the specified text.

Parameters​

ParameterType
textstring

Returns​

Menu


fontEditor()​

fontEditor(initial, options?): Menu

Defined in: js-api/src/widgets/menu.ts:120

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.


group()​

group(text, order?): Menu

Defined in: js-api/src/widgets/menu.ts:85

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

Parameters​

ParameterTypeDefault value
textstringundefined
ordernumber | nullnull

Returns​

Menu


header(text, options?): Menu

Defined in: js-api/src/widgets/menu.ts:150

Adds a header title.

Parameters​

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

Returns​

Menu

this menu itself.


hide()​

hide(): void

Defined in: js-api/src/widgets/menu.ts:166

Hides the menu.

Returns​

void


item()​

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

Defined in: js-api/src/widgets/menu.ts:96

Adds a menu group with the specified text and handler.

Parameters​

ParameterTypeDefault value
textstringundefined
onClick() => voidundefined
ordernumber | nullnull
optionsIMenuItemOptions | nullnull

Returns​

Menu


items()​

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

Defined in: js-api/src/widgets/menu.ts:101

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

Type Parameters​

Type ParameterDefault type
Tany

Parameters​

ParameterTypeDefault value
itemsT[]undefined
onClick(item) => voidundefined
optionsIMenuItemsOptions<T> | nullnull

Returns​

Menu


multiColumnSelector()​

multiColumnSelector(dataFrame, options?): Menu

Defined in: js-api/src/widgets/menu.ts:140

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.


remove()​

remove(text): void

Defined in: js-api/src/widgets/menu.ts:75

Removes a child menu item with the specified text.

Parameters​

ParameterType
textstring

Returns​

void


separator()​

separator(): Menu

Defined in: js-api/src/widgets/menu.ts:155

Adds a separator line.

Returns​

Menu


show()​

show(options?): Menu

Defined in: js-api/src/widgets/menu.ts:161

Shows the menu.

Parameters​

ParameterType
options?IShowMenuOptions

Returns​

Menu

this menu itself.


singleColumnSelector()​

singleColumnSelector(dataFrame, options?): Menu

Defined in: js-api/src/widgets/menu.ts:129

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.


toString()​

toString(): string

Defined in: js-api/src/widgets/menu.ts:187

Returns​

string


create()​

static create(): Menu

Defined in: js-api/src/widgets/menu.ts:47

Creates a top menu.

Returns​

Menu


static popup(): Menu

Defined in: js-api/src/widgets/menu.ts:52

Creates a popup menu.

Returns​

Menu