# GC.Spread.Sheets.ContextMenu.ContextMenu

## Content

# Class: ContextMenu

[Sheets](../modules/GC.Spread.Sheets).[ContextMenu](../modules/GC.Spread.Sheets.ContextMenu).ContextMenu

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.ContextMenu.ContextMenu#constructor)

### Properties

- [menuData](GC.Spread.Sheets.ContextMenu.ContextMenu#menudata)
- [menuView](GC.Spread.Sheets.ContextMenu.ContextMenu#menuview)

### Methods

- [onOpenMenu](GC.Spread.Sheets.ContextMenu.ContextMenu#onopenmenu)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new ContextMenu**()

Represents ContextMenu

## Properties

### <a id="menudata" name="menudata"></a> menuData

• **menuData**: [`IMenuItemData`](../interfaces/GC.Spread.Sheets.ContextMenu.IMenuItemData)[]

Represents the build-in menuData

**`property`** {string} [name] - Represent context menu item's identify.

**`property`** {string} [text] - Represent the text to be shown,if this context menu item is a group,text will be shown as DOM element's title.

**`property`** {string|Function} [command] - Represent a command name,commandManager will use this as index to find this command,if this command exist,then execute it.

**`property`** {boolean} [disable] - Represent this context menu item is disabled under current condition, default value is false.

**`property`** {string} [iconClass] - Represent this context menu item's icon,it is a class name.

**`property`** {string} [group] - Represent this context menu item is a group menu item and this property's value should be it's group header's name.

**`property`** {Object[]} [subMenu] - Represent this context menu item has sub menu.

**`property`** {string} [type] - Represent a context menu's type.

**`property`** {string} [workArea] - Represent this context menu item's should be shown on what area,value can be a collection of conditions,separate by whitespace. include: "outline","rowHeader","colHeader","corner","slicer","chart","shape","table","vpWithoutTb","pivotPageFilter","pivotTopLeft","pivotEmptyLabel","pivotHeader","pivotGrandTotal","pivotContent","pivotTable".

___

### <a id="menuview" name="menuview"></a> menuView

• **menuView**: [`MenuView`](GC.Spread.Sheets.ContextMenu.MenuView)

Represents the build-in menuView

## Methods

### <a id="onopenmenu" name="onopenmenu"></a> onOpenMenu

▸ **onOpenMenu**(`menuData`, `itemsDataForShown`, `hitInfo`, `spread`): `boolean`

open context menu

**`example`**
```
   var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
   spread.contextMenu.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;
   };
```

#### Parameters

| Name | Type |
| :------ | :------ |
| `menuData` | [`IMenuItemData`](../interfaces/GC.Spread.Sheets.ContextMenu.IMenuItemData)[] |
| `itemsDataForShown` | [`IMenuItemData`](../interfaces/GC.Spread.Sheets.ContextMenu.IMenuItemData)[] |
| `hitInfo` | `Object` |
| `spread` | `Object` |

#### Returns

`boolean`

indicate whether or not the contextmenu event has been processed done
