补充一点,Spread JS原生也支持Delete键删除某个区域的响应事件,
代码示例如下:
- spread.bind(GcSpread.Sheets.Events.RangeChanged, function (s, e) {
- // 本次range changed 事件的操作类型
- var action = e.action;
- var changedCells = e.changedCells;
- // 以下参数本例没有用到
- var column = e.column;
- var columnCount = e.columnCount;
- var row = e.row;
- var rowCount = e.rowCount;
- // 判断是否是clear删除事件
- if(action === GcSpread.Sheets.RangeChangedAction.Clear){
- changedCells.forEach(function (cell) {
- if(range.contains(cell.row, cell.col, 1,1)){
- console.log("触发事件!");
- }
- });
- }
- });
复制代码 |