按照咱们官网例子这么写的 ,应该改哪里?:
let commanddel = {
canUndo: true,
execute: function(context, options, isUndo) {
let Commands = GC.Spread.Sheets.Commands;
if (isUndo) {
Commands.undoTransaction(spread, options);
return true;
} else {
Commands.startTransaction(context, options);
//禁止删除
console.log(context.getActiveSheet().getActiveColumnIndex());
if (context.getActiveSheet().getActiveColumnIndex() != 1
&& context.getActiveSheet().getActiveColumnIndex() != 2
&& context.getActiveSheet().getActiveColumnIndex() != 3
&& context.getActiveSheet().getActiveColumnIndex() != 7
) {
return false;
}
Commands.endTransaction(context, options);
alert('禁止删除');
return true;
}
}
}; |