Skip to main content

Menu

Defined in: src/widgets/menu.ts:38

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

Constructor

new Menu(dart): Menu

Defined in: src/widgets/menu.ts:42

Parameters

ParameterType
dartany

Returns

Menu

Properties

PropertyTypeDefined in
_checkHTMLDivElementsrc/widgets/menu.ts:40
dartanysrc/widgets/menu.ts:39

Accessors

closeOnClick

Get Signature

get closeOnClick(): boolean

Defined in: src/widgets/menu.ts:60

Whether the menu closes when clicked.

Returns

boolean

Set Signature

set closeOnClick(value): void

Defined in: src/widgets/menu.ts:61

Parameters
ParameterType
valueboolean
Returns

void


onClose

Get Signature

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

Defined in: src/widgets/menu.ts:183

Returns

Observable<EventData<any>>


onContextMenuItemClick

Get Signature

get onContextMenuItemClick(): Observable<any>

Defined in: src/widgets/menu.ts:179

Returns

Observable<any>


root

Get Signature

get root(): HTMLElement

Defined in: src/widgets/menu.ts:57

Visual root

Returns

HTMLElement

Methods

bind()

bind(element): Menu

Defined in: src/widgets/menu.ts:171

Binds the menu to the specified options.element

Parameters

ParameterType
elementHTMLElement

Returns

Menu


clear()

clear(): void

Defined in: src/widgets/menu.ts:80

Removes all child menu items.

Returns

void


click()

click(): void

Defined in: 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: 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: 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: 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: 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: 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: 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: src/widgets/menu.ts:166

Returns

void


item()

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

Defined in: 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: 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: 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: src/widgets/menu.ts:75

Removes a child menu item with the specified text.

Parameters

ParameterType
textstring

Returns

void


separator()

separator(): Menu

Defined in: src/widgets/menu.ts:156

Adds a separator line.

Returns

Menu


show()

show(options?): Menu

Defined in: src/widgets/menu.ts:162

Shows the menu.

Parameters

ParameterType
options?IShowMenuOptions

Returns

Menu

this menu itself.


singleColumnSelector()

singleColumnSelector(dataFrame, options?): Menu

Defined in: 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: src/widgets/menu.ts:185

Returns

string


create()

static create(): Menu

Defined in: src/widgets/menu.ts:47

Creates a top menu.

Returns

Menu


static popup(): Menu

Defined in: src/widgets/menu.ts:52

Creates a popup menu.

Returns

Menu