您好,可以通过重写右键菜单来实现:
- let oldOpenMenu = spread.contextMenu.onOpenMenu;
- spread.contextMenu.onOpenMenu = function (
- menuData,
- itemsDataForShown,
- hitInfo,
- spread
- ) {
- oldOpenMenu.apply(this, arguments);
- console.log(itemsDataForShown);
- let { row, col } = hitInfo.worksheetHitInfo;
- if (row > 5) {
- for (const element of itemsDataForShown) {
- const item = element;
- if (item.name == "deleteDialog" || item.name == "gc.spread.contextMenu.deleteRows") {
- item.disable = true;
- }
- }
- }
- };
复制代码 |