Right click event on cell/ Context Menu Overriding

Posted by: saikiran.anugu on 16 May 2021, 5:15 pm EST

  • Posted 16 May 2021, 5:15 pm EST

    I would like to override context menu styles and functionalities .I Couldn't find any event related to right click on cell. If there is right click event handler please provide me some example or documentation on that or else information related to overriding styles and functionalities in context menu.
  • Replied 17 May 2021, 8:12 pm EST

    Hi,

    For this, you need to override the openContexmenu Method. Please refer to the following code snippet and let us know if you face any issues.


    $(document).ready(function () {
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
    function ContextMenu(){}
    ContextMenu.prototype = new GC.Spread.Sheets.ContextMenu.ContextMenu(spread);
    ContextMenu.prototype.onOpenMenu = function (menuData, itemsDataForShown, hitInfo, spread) {
    console.log(menuData);
    console.log(itemsDataForShown);
    console.log(hitInfo);
    console.log(spread);
    //you can change itemsDataForShown to change filter result
    //if you only want to change filter result,return false or don't return anything
    //you also can open your own context menu,if you want to do this,return true
    //return true;
    };
    var contextMenu = new ContextMenu();
    spread.contextMenu = contextMenu;
    });


    customContexMenu Demo: https://www.grapecity.com/spreadjs/demos/features/worksheet/context-menu/custom-menu-view#demo_source_name

    Regards
    Avinash
  • Replied 19 May 2021, 3:57 pm EST

    Hi, Thanks for the update, is there any event for handling cell right click?
  • Marked as Answer

    Replied 19 May 2021, 10:41 pm EST

    Hi,

    We are sorry but there is no event available for cell right Click but you call the event handler inside the onOpenMenu method. Please let me know if you have any further queries regarding this issue.

    Regards
    Avinash
Need extra support?

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

Learn More

Forum Channels