Context menu disabled in read only cells

Tags: #<Tag:0x00007efc64cb6c88> #<Tag:0x00007efc64cb6b20>

Hi, I am new to programming and I am experimenting with handsontable, if you can help me or give me an idea of how I can make a logic so that if a cell is read only the context menu does not appear or at least does not allow to add rows above or below the read only box, thank you very much for your time, best wishes to you.

Hi @codigomarce

Welcome to our forum!

For this specific task, you can use the beforeContextMenuShow hook to run the close() method on the menu. Demo: https://stackblitz.com/edit/ewwpsk-m1cv49?file=index.js The flaw here is that we can see the flash of the menu when it opens and closes.

Then, there’s also an option to show no available options for the given cells. Here https://stackblitz.com/edit/vitejs-vite-jdasx7?file=main.js,style.css&terminal=dev is a demo that shows how to do that. This time, we are setting up the custom context menu. You can use a predefined list of options from the following list: https://handsontable.com/docs/javascript-data-grid/api/context-menu/#executecommand, but you need to add the hidden() method setup.

If you need anything more than that, please let me know.

ps. I keep my fingers crossed for the project.