TableView customizations

Got it. One way to modify the viewer’s context menu would be to intercept the global “onContextMenu” event, as shown in this post: Mouse Event is Not Triggered

Here’s the working example that modifies grid’s menu:

grok.events
    .onContextMenu
    .subscribe((args) => {
        if (args.args.context instanceof DG.Viewer && JSON.parse(args.args.context.getOptions()).type == 'Grid') {
            grok.shell.info(args.args.context.table.name);
            args.args.menu.clear();
            args.args.menu.item('Yo!', () => grok.shell.info('Handled!'));
        }
    });

1 Like