This is a migrated thread and some comments may be shown as answers.
Spreadsheet undo doesn't sync with datasource
1 Answer 29 Views
This is a migrated thread and some comments may be shown as answers.
Anna
Top achievements
Rank 1
Anna asked on 23 Jan 2018, 08:10 PM

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

 

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 25 Jan 2018, 12:00 PM
Hello Anna,

Thank you for the detailed explanation of the case.

I have followed the steps listed below on the Spreadsheet DataSource binding demo. Here you will find a short video of performing the test:

- First, I am creating a formula summing some of the values of the dataItems loaded in the Spreadsheet. Initially, the calculated value is 191;

- Then, I am changing the value of one of the cells in the range from 10 to 1000. The new calculated value is 1181;

- I am saving the changes to the remote;

- I am pressing the Ctrl + Z to undo the cell value change. The calculated value also changes back to 191;

- By clicking the Save changes button, I am saving the reverted value to the remote.

May I ask you to describe how your scenario defers from the above? Also, if the issue observed could not be replicated on the DataSource binding demo, please prepare and send us a small isolated runnable sample demonstrating the problem.

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Anna
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or