SpreadJS 14
GC.Spread.Sheets.ContextMenu Namespace / ContextMenu type / onOpenMenu Method
Represent context menu item's identify.
Represent the text to be shown,if this context menu item is a group,text will be shown as DOM element's title.
Represent a command name,commandManager will use this as index to find this command,if this command exist,then execute it.
Represent this context menu item is disabled under current condition, default value is false.
Represent this context menu item's icon,it is a class name.
Represent this context menu item is a group menu item and this param's value should be it's group header's name.
Represent this context menu item has sub menu.
Represent a context menu's type.
Represent this context menu item's should be shown on what area,value can be a collection of conditions,separate by whitespace. include: "sheetTab", "outline", "viewport", "rowHeader", "colHeader", "comment", "slicer", "corner".
In This Topic
    onOpenMenu Method
    In This Topic
    open context menu
    Syntax
    var instance = new GC.Spread.Sheets.ContextMenu.ContextMenu();
    var value; // Type: boolean
    value = instance.onOpenMenu(menuData,
                                menuData.name,
                                menuData.text,
                                menuData.command,
                                menuData.disable,
                                menuData.iconClass,
                                menuData.group,
                                menuData.subMenu,
                                menuData.type,
                                menuData.workArea,
                                itemsDataForShown,
                                itemsDataForShown.name,
                                itemsDataForShown.text,
                                itemsDataForShown.command,
                                itemsDataForShown.disable,
                                itemsDataForShown.iconClass,
                                itemsDataForShown.group,
                                itemsDataForShown.subMenu,
                                itemsDataForShown.type,
                                itemsDataForShown.workArea,
                                hitInfo,
                                spread);
    function onOpenMenu( 
       menuData : undefined,
       (optional) menuData.name : string,
       (optional) menuData.text : string,
       (optional) menuData.command : undefined,
       (optional) menuData.disable : boolean,
       (optional) menuData.iconClass : string,
       (optional) menuData.group : string,
       (optional) menuData.subMenu : undefined,
       (optional) menuData.type : string,
       (optional) menuData.workArea : string,
       itemsDataForShown : undefined,
       (optional) itemsDataForShown.name : string,
       (optional) itemsDataForShown.text : string,
       (optional) itemsDataForShown.command : undefined,
       (optional) itemsDataForShown.disable : boolean,
       (optional) itemsDataForShown.iconClass : string,
       (optional) itemsDataForShown.group : string,
       (optional) itemsDataForShown.subMenu : undefined,
       (optional) itemsDataForShown.type : string,
       (optional) itemsDataForShown.workArea : string,
       hitInfo : Object,
       spread : Object
    ) : boolean;

    Parameters

    menuData
    menuData.name
    Represent context menu item's identify.
    menuData.text
    Represent the text to be shown,if this context menu item is a group,text will be shown as DOM element's title.
    menuData.command
    Represent a command name,commandManager will use this as index to find this command,if this command exist,then execute it.
    menuData.disable
    Represent this context menu item is disabled under current condition, default value is false.
    menuData.iconClass
    Represent this context menu item's icon,it is a class name.
    menuData.group
    Represent this context menu item is a group menu item and this param's value should be it's group header's name.
    menuData.subMenu
    Represent this context menu item has sub menu.
    menuData.type
    Represent a context menu's type.
    menuData.workArea
    Represent this context menu item's should be shown on what area,value can be a collection of conditions,separate by whitespace. include: "sheetTab", "outline", "viewport", "rowHeader", "colHeader", "comment", "slicer", "corner".
    itemsDataForShown
    itemsDataForShown.name
    Represent context menu item's identify.
    itemsDataForShown.text
    Represent the text to be shown,if this context menu item is a group,text will be shown as DOM element's title.
    itemsDataForShown.command
    Represent a command name,commandManager will use this as index to find this command,if this command exist,then execute it.
    itemsDataForShown.disable
    Represent this context menu item is disabled under current condition, default value is false.
    itemsDataForShown.iconClass
    Represent this context menu item's icon,it is a class name.
    itemsDataForShown.group
    Represent this context menu item is a group menu item and this param's value should be it's group header's name.
    itemsDataForShown.subMenu
    Represent this context menu item has sub menu.
    itemsDataForShown.type
    Represent a context menu's type.
    itemsDataForShown.workArea
    Represent this context menu item's should be shown on what area,value can be a collection of conditions,separate by whitespace. include: "sheetTab", "outline", "viewport", "rowHeader", "colHeader", "comment", "slicer", "corner".
    hitInfo
    spread
    Example
    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;
    See Also