禁用 delete, 把 clear 的快捷键设成空即可:
spread.commandManager().setShortcutKey("clear");
按 delete 的时候将值设置成0:
sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
if (args.action === GC.Spread.Sheets.RangeChangedAction.clear) {
for (var i = 0; i < args.changedCells.length; i++) {
var cell = args.changedCells[i];
args.sheet.setValue(cell.row, cell.col, 0);
}
}
}); |