SpreadJS版本:V11
再现:
借用页面:http://demo.grapecity.com.cn/Spr ... /demos/spreadEvents
修改JS代码为:
- $(document).ready(function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 3 });
- initSpread(spread);
- });
- function initSpread(spread) {
- var spreadNS = GC.Spread.Sheets;
- var sd = dataSource;
- var sheet = spread.getActiveSheet();
- sheet.setValue(0, 0, 1);
- sheet.setValue(0, 1, 2);
- sheet.setFormula(0, 2, '=A1+B1');
- spread.bind(spreadNS.Events.CellChanged, function (e, args) {
- if(args.propertyName === 'value')
- console.log(e.type + JSON.stringify({col: args.col, row: args.row}));
- });
- spread.bind(spreadNS.Events.RangeChanged, function (e, args) {
- console.log(e.type + JSON.stringify(args.changedCells));
- });
- };
复制代码 正常步骤:
1. 打开Console;
2. 修改A1单元格为2;
3. Console中打印:
- CellChanged{"col":0,"row":0}
- RangeChanged[{"row":0,"col":2}]
复制代码
异常步骤1:
1. 打开Console;
2. 从其他地方复制一个数字2,粘贴到单元格A1;
3. Console中打印:
- RangeChanged[{"row":0,"col":0}]
复制代码
异常步骤2:
1. 打开Console;
2. 选择单元格A1, 按下Delete键;
3. Console中打印:
- RangeChanged[{"row":0,"col":0}]
复制代码
总结:
如果更改单元格会引发CellChanged事件,那么由于更改单元格导致的公式变更会触发RangeChanged事件;
如果更改单元格会引发RangeChanged事件,那么由于更改单元格导致的公式变更不会触发RangeChanged事件;
|
|