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
| Parameter | Type |
|---|---|
dart | any |
Returns
Source
Properties
| Property | Type | Default value |
|---|---|---|
_check | HTMLDivElement | ... |
dart | any | undefined |
Accessors
closeOnClick
getcloseOnClick():boolean
Whether the menu closes when clicked.
setcloseOnClick(value):void
Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
boolean
Source
onContextMenuItemClick
getonContextMenuItemClick():Observable<any>
Returns
Observable<any>
Source
root
getroot():HTMLElement
Visual root
Returns
HTMLElement
Source
Methods
bind()
bind(
element):Menu
Binds the menu to the specified options.element
Parameters
| Parameter | Type |
|---|---|
element | HTMLElement |
Returns
Source
clear()
clear():
void
Removes all child menu items.
Returns
void
Source
click()
click():
void
Executes the onClick function for that menu item. Only works for items, not groups.
Returns
void
Source
colorPalette()
colorPalette(
colors,options?):Menu
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
this menu itself.
Source
endGroup()
endGroup():
Menu
Ends a group of menu items and returns to the higher menu level.
Returns
this menu itself.
Source
find()
find(
text):Menu
Finds a child menu item with the specified text.
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
Source
fontEditor()
fontEditor(
initial,options?):Menu
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
this menu itself.
Source
group()
group(
text,order):Menu
Returns an existing menu group or adds a new group with the specified text.
Parameters
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
order | null | number | null |
Returns
Source
header()
header(
text,options?):Menu
Adds a header title.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Header title text. |
options? | IMenuHeaderOptions | Optional params and functions, see IMenuHeaderOptions. |
Returns
this menu itself.
Source
hide()
hide():
void
Returns
void
Source
item()
item(
text,onClick,order,options):Menu
Adds a menu group with the specified text and handler.
Parameters
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
onClick | () => void | undefined |
order | null | number | null |
options | null | IMenuItemOptions | null |
Returns
Source
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 parameter | Value |
|---|---|
T | any |
Parameters
| Parameter | Type | Default value |
|---|---|---|
items | T[] | undefined |
onClick | (item) => void | undefined |
options | null | IMenuItemsOptions<T> | null |
Returns
Source
multiColumnSelector()
multiColumnSelector(
dataFrame,options?):Menu
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
this menu itself.
Source
remove()
remove(
text):void
Removes a child menu item with the specified text.
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
Source
separator()
separator():
Menu
Adds a separator line.
Returns
Source
show()
show(
options?):Menu
Shows the menu.
Parameters
| Parameter | Type |
|---|---|
options? | IShowMenuOptions |
Returns
this menu itself.
Source
singleColumnSelector()
singleColumnSelector(
dataFrame,options?):Menu
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
this menu itself.
Source
toString()
toString():
string
Returns
string
Source
create()
staticcreate():Menu
Creates a top menu.
Returns
Source
popup()
staticpopup():Menu
Creates a popup menu.