Set order into the context menu

Posted by: rpatel on 19 October 2018, 5:21 pm EST

    • Post Options:
    • Link

    Posted 19 October 2018, 5:21 pm EST - Updated 3 October 2022, 1:00 am EST

    Hello,

    Can you please guide me for how I can set order for the context menu in spreadsheet.

    I have created few custom menu option but how I can set order into existing menu options.

    Below url for adding context menu but wiki never mention custom ordering for menus.

    http://help.grapecity.com/spread/SpreadSheets11/webframe.html#UsingtheContextMenu.html

    Thanks,

    Ravish

  • Posted 21 October 2018, 3:39 am EST - Updated 3 October 2022, 1:00 am EST

    I more thing, I already added context menu, after adding it’s showing top of the bar. I want to changed to after “Clear Contents”.

  • Posted 22 October 2018, 1:24 am EST

    Hello,

    Since MenuData is an array you can use ‘splice’ function to insert your menu option at a specific location. For example:

    var openDialog = {
        text: 'Open Dialog',
        name: 'openDialog',
        command: showLoginDialog,
        workArea: 'viewport'
    };
    spread.contextMenu.menuData.push(openDialog);
    function showLoginDialog() {
        //to do something
    }
    
    // Add/Remove the custom menu options
    
    $.each(spread.contextMenu.menuData, function (p, v) {
        if (v.name === 'openDialog') { //openDialog is a command's name
            spread.contextMenu.menuData.splice(p, 1)
        }
    });
    

    Please refer to the attached sample.

    Thanks,

    Deepak SharmaSpreadJSCustomContextMenu.zip

  • Posted 23 October 2018, 2:33 am EST

    Thanks Deepak !!

  • Posted 21 January 2021, 12:17 am EST

    Hi deepak,

    I dont see any option for inserting/deleting rows or cells in contextmenu

    can You please advise on how to do that?

  • Posted 21 January 2021, 11:09 pm EST - Updated 3 October 2022, 1:00 am EST

    Hi Harsha,

    You need to first select the row or a column that you want to delete or insert then right-click for contextMenu. Please refer to the following attached gif and let us know if you face any issues.

    Regards

    Avinash

Need extra support?

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

Learn More

Forum Channels