How to Detect Cell change when cell value changes due to contained function

Posted by: curiosichi on 5 September 2018, 8:14 am EST

  • Posted 5 September 2018, 8:14 am EST

    I've learned now to detect cell changes by the many events included with wijmo: cellEditEnding, CellEditEnded, pastingCell, ect ect

    What I have haven't been able to solve is cells that contain functions and how to capture with a handler when that cell value changes.

    For example, let's say cell A3's value is "=Sum(A1:A2)".

    If A1 value is changed to 1, and A2 value is changed to 1, A3 will show 2. It changes from 0, to 1, to 2, but every time it changes it never triggers a cellEdit.

    What is the proper hook to capture cell A3's value changing?



    // what goes here ???
    this.Workbook.????????????????.addHandler((s, e: any) => {

    this.processCellChange(e.row, e.col);

    });

  • Replied 5 September 2018, 11:05 pm EST

    Hi,

    Currently, there is no event in FlexSheet which is raised when the value of dependent cell changes.
    However you may maintain a dictionary of cellDependencies and then in cellEditEvent, check if the edited cell has any dependent cell and if a dependent cell is present then raise a custom event indicating value change in the dependent cell.
    Please refer to the following cell which implements the same:-
    https://stackblitz.com/edit/angular-3f1jmc?file=app%2Fapp.component.ts

    ~Sharad
Need extra support?

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

Learn More

Forum Channels