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
| Parameter | Type |
|---|---|
dart | any |
Returns
Menu
Properties
| Property | Type | Defined in |
|---|---|---|
_check | HTMLDivElement | src/widgets/menu.ts:40 |
dart | any | src/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
| Parameter | Type |
|---|---|
value | boolean |
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
| Parameter | Type |
|---|---|
element | HTMLElement |
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
| Parameter | Type | Description |
|---|---|---|
colors | number[][] | Array of arrays of color choices. |
options? | IMenuColorPaletteOptions | Optional 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
| Parameter | Type |
|---|---|
text | string |
Returns
Menu
fontEditor()
fontEditor(
initial,options?):Menu
Defined in: src/widgets/menu.ts:120
Adds font editor to menu.
Parameters
| Parameter | Type | Description |
|---|---|---|
initial | string | Initial font to be set first or reset. |
options? | IMenuFontEditorOptions | Optional 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
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
order | number | null | null |
Returns
Menu
header()
header(
text,options?):Menu
Defined in: src/widgets/menu.ts:150
Adds a header title.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Header title text. |
options? | IMenuHeaderOptions | Optional 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
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
onClick | () => void | undefined |
order | number | null | null |
options | IMenuItemOptions | null | null |
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 Parameter | Default type |
|---|---|
T | any |
Parameters
| Parameter | Type | Default value |
|---|---|---|
items | T[] | undefined |
onClick | (item) => void | undefined |
options | IMenuItemsOptions<T> | null | null |
Returns
Menu
multiColumnSelector()
multiColumnSelector(
dataFrame,options?):Menu
Defined in: src/widgets/menu.ts:140
Adds multi-column selector to menu.
Parameters
| Parameter | Type | Description |
|---|---|---|
dataFrame | DataFrame | Data frame to be used for the selector,where column choices are taken from. |
options? | IMenuMultiColumnSelectorOptions | Optional 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
| Parameter | Type |
|---|---|
text | string |
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
| Parameter | Type |
|---|---|
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
| Parameter | Type | Description |
|---|---|---|
dataFrame | DataFrame | Data frame to be used for the selector,where column choices are taken from. |
options? | IMenuSingleColumnSelectorOptions | Optional params and functions, see IMenuSingleColumnSelectorOptions. |
Returns
Menu
this menu itself.
toString()
toString():
string
Defined in: src/widgets/menu.ts:185
Returns
string
create()
staticcreate():Menu
Defined in: src/widgets/menu.ts:47
Creates a top menu.
Returns
Menu
popup()
staticpopup():Menu
Defined in: src/widgets/menu.ts:52
Creates a popup menu.
Returns
Menu