Disable delete sheet based on condition in contextmenu

Posted by: sharaththota.zem on 24 November 2022, 6:29 pm EST

  • Posted 24 November 2022, 6:29 pm EST

    Hi Team,

    i want to disable gc.spread.contextmenu.deletesheet . if there is one worksheet in a workbook then delete should disable,if there are multiple sheets ,need to enable delete option.

    Also when i’m trying to get GC.Spread.Sheets.contextMenu.menuData (or)GC.Spread.Sheets.contextMenu.contextMenu…menuData getting output as undefined while using

    setMenuDataDisable(spread.contextMenu.menuData, “gc.spread.deleteSheet”, false);

    function setMenuDataDisable(menuData, optionName, value){

    Array.prototype.forEach.call(menuData, function(data){

    if(data.name == optionName){

    data.disable = value;




  • Posted 27 November 2022, 9:30 pm EST


    You can find a discussion of a similar use case in the following forum case: https://www.grapecity.com/forums/spreadjs/disable-delete-sheet-button-based-on-condition

    Please let us know if you require any additional assistance. We would be delighted to assist you.



  • Posted 27 November 2022, 9:42 pm EST

    Hi team

    but when i’m trying to get GC.Spread.Sheets.contextMenu.menuData (or)GC.Spread.Sheets.contextMenu.contextMenu.menuData getting output as undefined.

    so i’m unable to disable the delete option.

    current spreadjs version i’m using is 15.1.1

  • Posted 30 November 2022, 6:19 am EST


    ContextMenu is a class, and you should not invoke ContextMenu’s constructor directly like a function call. Instead, for accessing the menuData, use the code snippet below:


    Sample: https://jscodemine.grapecity.com/sample/BH4IULr80k6xsIa7VhMDsA/



Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels