使用delete后通过ctrl+z撤销,使用rangechange方法监听不到,目前是通过EUa获取到的区域,请问一下有没有其他的方法获取到该区域
commandManager.register('tabCmdDel', {
canUndo: true,
execute: function (context, options, isUndo) {
var Commands = $3rd.spreadJS.Sheets.Commands
options.cmd = "tabCmdDel"
if (isUndo) {
Commands.undoTransaction(context, options)
var activeSheet = StaticData.spread.getActiveSheet()
var sheetName = activeSheet.name()
var data = options['changes' + sheetName]
var eua = (data.EUa || []).reduce(function (calc, item) {
var val = item.value
if(!calc.some(function (c) { return c.row === val.row && c.col === val.col })){
calc.push({ row: val.row, col: val.col })
}
return calc
}, [])
StaticData.spread.suspendPaint()
for(var i = 0; i < eua.length; i ++){
var row = eua.row
var col = eua.col
me.handleCellValueChange({
row: row,
col: col,
value: activeSheet.getValue(row, col)
})
}
StaticData.spread.resumePaint()
return true
} else {
Commands.startTransaction(context, options)
valueChange(function (activeSheet,rowIndex, colIndex) {
activeSheet.setValue(rowIndex, colIndex, null)
})
Commands.endTransaction(context, options)
return true
}
}
})
|
|