Using ContextMenu component in Vaadin Spreadsheet

Hi!

We’re using the Spreadsheet flow component and have implemented custom actions that can be executed via the built-in context menu and use cell coordinates to manipulate specific cells. Now we’d like to implement an action that requires a hierarchical context menu. As far as I know that is not directly supported by the context menu that comes built-in with the Spreadsheet component.

My idea is to use the ContextMenu component as a replacement since that one supports hierarchical options natively. I have not found a solution to properly trigger the opening of the ContextMenu in the right position and pass in the cell information though.

Does anybody have any experience with this?

Best regards,
Sebastian

That can be very tricky. In theory you can fire fabricated contextmenu event with JavaScript, but obtaining the right coordinates can be the actual problem. I have here an example how I am doing this in Grid’s component column. In that case I can get coordinates from the rendered icon. But with Spreadsheet this will be substantially harder.