ce icon indicating copy to clipboard operation
ce copied to clipboard

onafterchange not reflecting correct values

Open Light2Dark opened this issue 7 months ago • 0 comments

Hi, first of all, thanks for the cool library! We are trying it out to see if it could be used for our tables.

There's an issue with onafterchanges handler, where it doesn't show the newValue field. Here's a JSFiddle to demonstrate: https://codepen.io/Shahmir-Varqha/pen/ByNPoVW

According to the types index.ts, onafterchange should return

  /**
     * Occurs after all changes are applied in the tables.
     * @param instance - Instance of the worksheet where the change occurred.
     * @param changes - list of changes.
     */
    onafterchanges?: (
      instance: WorksheetInstance,
      changes: CellChange[]
    ) => void;

  interface CellChange {
    newValue: CellValue;
    oldValue: CellValue;
    x: string;
    y: string;
  }

However, logging the changes

<Spreadsheet onafterchanges={(instance, cellChanges) => console.log(cellChanges)}

We see this:
{
    "x": "1",
    "y": "2",
    "value": undefined,
    "oldValue": "1"
}

Is there a bug here? I do not see the updated value.

Light2Dark avatar Jun 16 '25 07:06 Light2Dark