[React] How do I render the contextMenu?

Tags: #<Tag:0x00007f8b28c18288>

I’ve created a simple React application and have made a HotTable instance just like the example in the JSFiddle, in the official documentation.

In the JSFiddle, the context menu does appear on right click of a cell. On my React application the native context menu appears on right click of a cell. How can I make the handsontable context menu appear?

Hi @amit.biswas

The only thing to make it work is to setup the context Menu configuration option to true, like here:

contextMenu={true} 

If that doesn’t work for you I will need to see your code.

Hi @adrian.szymanski

Thanks for the reply. Yes I’ve tried contextMenu={true} but I still don’t see the handsontable context menu.

Here’s a link to the sand box of the code: https://codesandbox.io/s/loving-forest-3ubwg7?file=/src/App.js

Hi @adrian.szymanski

An update: I suspect it has something to do with the newer React version.

Here is a demo handsontable React app where the context menu works using
handsontable@12.0.0
react@16.14.0

Here is a fork of the demo with only the libraries being updated to latest
handsontable@12.1.3
react@18.2.0

In the latest version example, the context menu isn’t working

Hi @amit.biswas

Thank you for the examples. This issue is present only in Codesandbox. I checked the same project locally and everything works fine with Handsontable 12.1.3 and React 18.2.0.

Here’s an example in jsFiddle with the same packages and it also works fine: https://jsfiddle.net/aszymanski/yc3h1d58/

1 Like