Hi Kendo folks,
In our implementation of kendo spreadsheet, we use datasource binding, and rely closely on kendo spreadsheet to notify datasource about changes to the sheets to keep data consistent. However, we noticed that undo command (whether triggered by undo button or ctrl+z) will not notify the datasource about this change. For example, cell A:1 - Y:1 are bind to values in datasource, and Z:1 is bind a sum property which totals the values bind to A:1 - Y:1.
When user
1. enter value 1 in cell A:1 (value 1 appears in Z:1)
2. undo (ctrl+z)
expected: value 0 in Z:1, actual: value 1 remains in Z:1.
We hope kendo can fix this; it feels inconsistent. Other operation such as paste can consistently synchronize with datasource, but the undo doesn't.
Below are a bit of our finding in kendo source code, and hope that could help :
On paste (ctrl+v), the paste function calls range to setSate, and then sheet.triggerChange to invoke the SheetDataSourceBinder._sheetChange function, who calls the Range.values function, which is responsible for binding with datasource. However, Range.values is invoked only if e.ref (range reference) is provided. When user triggers undo, undo function will also trigger range.setState() function, but setState function itself will trigger the _sheetChange function without reference information, causing it to skip Range.values function. We suggest the undo function to do the same thing as paste, after calling range().setState(), also triggerChange with range reference.
Currently
paste => range().setState() & triggerChange({... ref: ref}) => SheetDataSourceBinder._sheetChange => Range.values
undo => range().setState() => SheetDataSourceBinder._sheetChange (no ref provided, end)
Best,
Anna