根据您的需求,对代码进行了修改,您可以测试下。
代码如下:
- sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
- console.log("RangeChanged")
- console.log(args);
- if (args.action == 1 || args.action == 2 || args.action == 3 || args.action == 6) {
- var sc_col_no = 4;
- var value = sheet.getValue(args.row, args.col);
- if(args.isUndo) {
- if(value) {
- sheet.setValue(args.row, sc_col_no, new Date(), GC.Spread.Sheets.SheetArea.viewport);
- } else {
- sheet.setValue(args.row, sc_col_no, null, GC.Spread.Sheets.SheetArea.viewport)
- }
- } else {
- if(value) {
- sheet.setValue(args.row, sc_col_no, new Date(), GC.Spread.Sheets.SheetArea.viewport);
- }
- }
- }
- });
- sheet.bind(GC.Spread.Sheets.Events.CellChanged, function (e, info) {
- console.log("CellChanged")
- console.log(info);
- if(info.newValue != null) {
- var sc_col_no = 4;
- sheet.setValue(info.row, sc_col_no, new Date(), GC.Spread.Sheets.SheetArea.viewport);
- } else {
- sheet.setValue(info.row, sc_col_no, null, GC.Spread.Sheets.SheetArea.viewport);
- }
- });
复制代码
完整代码请参考附件。
|
|