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
onContextMenuItemClick
get
onContextMenuItemClick():Observable
<any
>
Returns
Observable
<any
>
Source
root
get
root():HTMLElement
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
endGroup()
endGroup():
Menu
Ends a group of menu items and returns to the higher menu level.
Returns
Source
find()
find(
text
):Menu
Finds a child menu item with the specified text.
Parameters
Parameter | Type |
---|---|
text | string |
Returns
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
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
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
Source
toString()
toString():
string
Returns
string
Source
create()
static
create():Menu
Returns
Source
popup()
static
popup():Menu
Creates a popup menu.