1金币
本帖最后由 jyxu 于 2020-6-24 17:49 编辑
应用插件版本:13
问题现象:
撤销、恢复功能不生效(备注:ctrl+z、ctrl+y,可以正常撤销、恢复)
==========================
按照demo示例编写脚本如下:
==========================
var spread; var sheet; var excelIo;
window.onload = function () {
GC.Spread.Sheets.LicenseKey = SpreadjsHelper.key;
spread = new GC.Spread.Sheets.Workbook(document.getElementById('divTemplate'), { sheetCount: 4 });
var undoManager = spread.undoManager();
excelIo = new GC.Spread.Excel.IO();
sheet = spread.getActiveSheet();
$("#btnQuery").click();
//撤销
_getElementById('btnOndo').addEventListener('click', function () {
undoManager.undo();//不生效??
});
//恢复
_getElementById('btnRedo').addEventListener('click', function () {
undoManager.redo();//不生效??
});
//列操作
spread.bind(GC.Spread.Sheets.Events.ColumnChanged, function (sender, args) {
console.log(args);
//不允许插入列,插入后删除
if (args.propertyName === "addColumns") {
spread.getActiveSheet().deleteColumns(args.col, args.count);
}
});
//行操作
spread.bind(GC.Spread.Sheets.Events.RowChanged, function (sender, args) {
console.log(args);
//测试:业态行不允许删除
if (args.propertyName === "deleteRows") {
undoManager.undo();//不生效??
//逻辑:TODO
}
});
};
|
最佳答案
查看完整内容
附件上传了一个撤销的例子~ 您看一下,如果还有问题在这个demo上复现一下
|