Cell value change events

Posted by: jb9244 on 22 February 2018, 1:49 am EST

  • Posted 22 February 2018, 1:49 am EST

    Attached is an example of SpreadJS 11.0.4. The value for each cell from A1 to A3 depends on the value of the cell under it… so if A2 is “a”, A1 will be a, and so on. If A4 changes, A3 will change, and A2 will change, and A1 will change.

    The example provides an event log that captures three seemingly-relevant events that can be used to detect changes to cells: ValueChanged, CellChanged and RangeChanged.

    The issue: Changing the value of A4 changes the value for A1-A3, but only triggers events for A3 (the cell that references A4) and A4. The other cells whose values have also changed have no events triggered.

    How would I receive events for cells A1 and A2 in this scenario? Is this a bug?

    SpreadJS RangeChanged issue.zip

  • Posted 22 February 2018, 2:16 am EST

    I have the same problem, I need an event triggered when all the computations on the sheet are done. I’m using asynchronous custom functions, so I need to know when everything has been computed, so I can read the results in the cells.

  • Posted 22 February 2018, 8:53 pm EST

    Hello,

    I am able to replicate the issue at my end. I have submitted it as a bug to the development team for further investigation. I will let you know as soon as I get an update on this. The bug id for this issue is 254762.

    Thanks,

    Deepak Sharma

  • Posted 5 March 2018, 4:56 pm EST

    Hello,

    This found to be an intended behavior. The RangeChanged event will be fired for a range operation, and the cell value changed which caused by evaluating formula is one of the range operations, all the changed result is in changedCells event arguments.

    Please use the code like below in your sample, you will see the difference.

    
    spread.bind(GC.Spread.Sheets.Events.RangeChanged, function (name_data, ev_data) {
        ev_data.changedCells.forEach(function (cell) {
            $("#event_log").html($("#event_log").html() + "RangeChanged: " + String.fromCharCode(64 + cell.col + 1) + (cell.row + 1) + "<br>");
        })
        return true;
    });
    
    

    Thanks,

    Deepak Sharma

  • Posted 6 March 2018, 1:23 am EST

    Thank you for your reply. I am able to get events using your code.

    There is an instance where this doesn’t work, however. In my example, if you paste (CTRL-V) text into A4, you’ll only get a RangeChanged event for A4. Perhaps this is a bug?

  • Posted 7 March 2018, 1:44 am EST

    Hello,

    CellChanged event fires when the cell property is changed. RangeChanged event fires for Paste action which is correct behavior. In RangeChanged you can get to know which action is performed using the code as follows:

    
     activeSheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (sender, args) {
                    alert(args.sheetName+" "+ args.action);
                });
    
    

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels