Skip to main content

ContextMenuOptions

Interface

Use this interface to override the context menu.

Properties

items_processor

Optional

Provide this function if you want to change the set of actions being displayed in the context menu.

You can filter out, add yours and re-order items.

The library will call your function each time it wants to display a context menu and will provide a list of items to display. This function should return an array of items to display.

Example:

context_menu: {
items_processor: function(items, actionsFactory, params) {
console.log(`Menu name is: ${params.menuName}`);
const newItem = actionsFactory.createAction({
actionId: 'hello-world',
label: 'Say Hello',
onExecute: function() {
alert('Hello World');
},
});
items.unshift(newItem);
return Promise.resolve(items);
},
},

Type

ContextMenuItemsProcessor


renderer_factory

Optional

Provide this function to override the default renderer for context menu so you can adjust existing menu items.

Type

ContextMenuRendererFactory