您好,可以直接把这个选项删除即可,具体的操作方法,可以参考附件示例,
示例演示了当用户点击右键菜单时,会触发onOpenMenu事件,
在onOpenMenu方法中,判断并删除对应的项即可。
代码示例如下:
- $(document).ready(function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 3 });
- GC.Spread.Common.CultureManager.culture("zh-cn");
- var sheet = spread.getActiveSheet();
- sheet.setRowCount(5);
- function ContextMenu(){}
- ContextMenu.prototype = new GC.Spread.Sheets.ContextMenu.ContextMenu(spread);
- ContextMenu.prototype.onOpenMenu = function (menuData, itemsDataForShown, hitInfo, spread) {
- if(hitInfo.tabStripHitInfo){
- if(hitInfo.tabStripHitInfo.sheetTab.sheetName === "Sheet1"){
- var index = -1;
- for(let i=0; i<itemsDataForShown.length; i++){
- var item = itemsDataForShown[i];
- if(item.name === "gc.spread.deleteSheet"){
- index = i;
- break;
- }
- }
- if(index > -1){
- itemsDataForShown.splice(index, 1);
- }
- }
- }
- };
- spread.contextMenu = new ContextMenu();
- });
复制代码
|