javascript - 制表库和撤销功能
问题描述
我正在尝试将行菜单和标题菜单添加到我的表中。这两个函数都可以正常工作,但是函数 undo 不起作用并且函数 userTable.getHistoryUndoSize() 总是返回 0。当我手动编辑表中的数据时,撤消工作正常。有人可以帮助我做错什么吗?我正在使用最新的制表符 4.8.3
谢谢
var rowMenu = [{
label:"Enable All Floors",
action:function(e, row){
userTable.blockRedraw();
row.update({f1:true});row.update({f2:true});row.update({f3:true});row.update({f4:true});row.update({f5:true});row.update({f6:true});
row.update({f7:true});row.update({f8:true});row.update({f9:true});row.update({f10:true});row.update({f11:true});row.update({f12:true});
row.update({f13:true});row.update({f14:true});row.update({f15:true});row.update({f16:true});
userTable.restoreRedraw();
}
},
{
label:"Disable All Floors",
action:function(e, row){
userTable.blockRedraw(); row.update({f1:false});row.update({f2:false});row.update({f3:false});row.update({f4:false});row.update({f5:false});row.update({f6:false});
row.update({f7:false});row.update({f8:false});row.update({f9:false});row.update({f10:false});row.update({f11:false});row.update({f12:false});
row.update({f13:false});row.update({f14:false});row.update({f15:false});row.update({f16:false});
userTable.restoreRedraw();
}
}
]
var headerMenu = [{
label:"Set All in column to ON",
action:function(e, column){
userTable.blockRedraw();
rows.forEach(function(row){
row.update({AL :true});
});
userTable.restoreRedraw();
}
},
{
label:"Set All in column to OFF",
action:function(e, column){
userTable.blockRedraw();
rows.forEach(function(row){
row.update({AL:false});
});
userTable.restoreRedraw();
}
}]
dataChanged:function(data){
console.log("data in table edited");
document.getElementById( 'undoBadge' ).innerHTML = userTable.getHistoryUndoSize();
document.getElementById('BTNundoData').removeAttribute("disabled");
PreventLoseData = true;
},
解决方案
推荐阅读
- c++ - 我的 if 语句没有正确执行(跳过 if)
- reactjs - 如何绑定到挂钩中引发的事件?
- css - 使用转换时结合旋转和翻译时的 Safari 错误
- python - 如何将 Pandas qcut 或类似函数应用于二维数组
- angular - 如何处理 RxJs websocket 连接关闭?在服务器关闭时重试,在客户端关闭时不执行任何操作
- javascript - Javascript InfluxDB-Client 中的“TypeError:t.complete 不是函数”
- html - _reboot.scss 正在覆盖我的自定义 CSS
- ios - 在 Swift 中将计算值作为参数传递
- unity3d - 当所有的点都被吃掉时,如何在 pakman 中结束游戏?
- python - 我无法使用 FIND_NEXT_SIBLING 而不是 PARENT 和 NEXT_ELEMENT 优化 beautifullsoup 查询