Class: Menu
dg.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
constructor
• new Menu(dart
)
Parameters
Name | Type |
---|---|
dart | any |
Defined in
Properties
_check
• _check: HTMLDivElement
Defined in
dart
• dart: any
Defined in
Accessors
onContextMenuItemClick
• get
onContextMenuItemClick(): Observable
<any
>
Returns
Observable
<any
>
Defined in
root
• get
root(): HTMLElement
Returns
HTMLElement
Defined in
Methods
bind
▸ bind(element
): Menu
Binds the menu to the specified options.element
Parameters
Name | Type |
---|---|
element | HTMLElement |
Returns
Defined in
clear
▸ clear(): void
Removes all child menu items.
Returns
void
Defined in
click
▸ click(): void
Executes the onClick function for that menu item. Only works for items, not groups.
Returns
void
Defined in
endGroup
▸ endGroup(): Menu
Ends a group of menu items and returns to the higher menu level.
Returns
Defined in
find
▸ find(text
): Menu
Finds a child menu item with the specified text.
Parameters
Name | Type |
---|---|
text | string |
Returns
Defined in
group
▸ group(text
, order?
): Menu
Returns an existing menu group or adds a new group with the specified text.
Parameters
Name | Type | Default value |
---|---|---|
text | string | undefined |
order | null | number | null |
Returns
Defined in
item
▸ item(text
, onClick
, order?
, options?
): Menu
Adds a menu group with the specified text and handler.
Parameters
Name | Type | Default value |
---|---|---|
text | string | undefined |
onClick | () => void | undefined |
order | null | number | null |
options | null | IMenuItemOptions | null |
Returns
Defined in
items
▸ items<T
>(items
, onClick
, options?
): Menu
For each item in items, adds a menu group with the specified text and handler.
Type parameters
Name | Type |
---|---|
T | any |
Parameters
Name | Type | Default value |
---|---|---|
items | T [] | undefined |
onClick | (item : T ) => void | undefined |
options | null | IMenuItemsOptions <T > | null |
Returns
Defined in
remove
▸ remove(text
): void
Removes a child menu item with the specified text.
Parameters
Name | Type |
---|---|
text | string |
Returns
void
Defined in
separator
▸ separator(): Menu
Adds a separator line.
Returns
Defined in
show
▸ show(options?
): Menu
Shows the menu.
Parameters
Name | Type |
---|---|
options? | IShowMenuOptions |
Returns
Defined in
toString
▸ toString(): string
Returns
string
Defined in
create
▸ Static
create(): Menu
Returns
Defined in
popup
▸ Static
popup(): Menu
Creates a popup menu.