[]
Sheets.ContextMenu.MenuView
• new MenuView()
Represents MenuView
▸ createMenuItemElement(menuItemData
): HTMLElement
create menuitem view
example
$(document).ready(function () {
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
function CustomMenuView() {
}
CustomMenuView.prototype = new GC.Spread.Sheets.ContextMenu.MenuView();
CustomMenuView.prototype.createMenuItemElement = function (menuItemData) {
var self = this;
var menuItemView = GC.Spread.Sheets.ContextMenu.MenuView.prototype.createMenuItemElement.call(self, menuItemData);
if (menuItemData.name === "markWithABg") {
var subMenuView = menuItemView.find(".gc-ui-contextmenu-container");
$(subMenuView[0]).colorpicker();
}
return menuItemView;
};
});
Name | Type | Description |
---|---|---|
menuItemData |
IMenuItemData |
the data of the menu item which needs to be shown |
HTMLElement
menuitem view
▸ getCommandOptions(menuItemData
, host
, event
): any
get command options of specified menu item
example
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
function CustomMenuView() {
}
CustomMenuView.prototype = new GC.Spread.Sheets.ContextMenu.MenuView();
CustomMenuView.prototype.getCommandOptions = function (menuItemData, host, event) {
if (menuItemData && menuItemData.name === "markWithABg") {
var ele = event.target || event.srcElement;
if (ele.className.indexOf("colorpicker-div-inner-colorcell") !== -1) {
ele = ele.parentElement;
}
return ele.style.background;
}
};
Name | Type | Description |
---|---|---|
menuItemData |
IMenuItemData |
the data of the menu item which be clicked |
host |
Object |
the container of the menu item which be clicked |
event |
Object |
the mouse click event |
any
command options of specified menu item
▸ maxHeight(value?
): number
| void
description
get or set context menu's max height
example
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
spread.contextMenu.menuView.maxHeight(400);
Name | Type |
---|---|
value? |
number |
number
| void
number | void
▸ scrollable(value?
): boolean
| void
description
get or set context menu scrollable
example
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
spread.contextMenu.menuView.scrollable(false);
Name | Type |
---|---|
value? |
boolean |
boolean
| void
boolean | void