This is a migrated thread and some comments may be shown as answers.

Spreadsheet Clear Undo/Redo History

5 Answers 272 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 30 Jun 2017, 08:44 PM

Hi Kendo UI Team

I'm trying to customize my kendo spreadsheet and I am trying to find a way to clear a user's undo/redo history on a button click.  I also want to do this without losing the undo/redo functionality. I noticed that there is an undoRedoStack in $('#SpreadsheetName').data("kendoSpreadsheet")._workbook, but when I pop from this undoRedoStack it gives an error when the user tries to undo/redo again.

Is there a way to clear the undo history in the spreadsheet?

 

Many thanks,

Jeff

5 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 04 Jul 2017, 02:07 PM
Hi Jeff,

Currently there is no built-in functionality (configuration option or API method) for clearing the undo/redo history so we would recommend logging this as a feature request in our Feedback Portal. Here you can find a dojo example, in which the default undo/redo buttons are clicked with jQuery based on two counters simulating a similar history clearing behavior.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jeffrey
Top achievements
Rank 1
answered on 10 Jul 2017, 09:31 PM

Hi,

For anyone curious, my team took the above dojo example and modified to suit our original needs - you can see the results of our changes here: http://dojo.telerik.com/ECOTO/8

However this does not account for user keyboard input shortcuts like CTRL+Z/Y

 

Thus, we have a followup question that is related - but for some reason I am unable to make a new thread for it so I will ask it here and hopefully someone picks up on it:

 

I'm looking to prevent or override the Spreadsheet's undo and redo keyboard shortcut functionality (CTRL+Z and CTRL+Y) while keeping the undo and redo buttons and respective functionality. I would also like to keep the other shortcuts (CTRL+C, CTRL+P, CTRL+V, etc).

I have the following code which allows me to do my custom undo/redo shortcut functions, however it does not prevent Spreadsheet's default CTRL+Z and CTRL+Y behavior.

            // Capture Ctrl Z and Ctrl Y then sync undo/redo counters (doStuff())
    $(document).keydown(function (e) {
         // Ctrl Z
         if (e.ctrlKey && e.keyCode == 90) {
                        preventdefault(e)
                     doStuff();
         }
         // Ctrl Y
         else if (e.ctrlKey && e.keyCode == 89) {
                        preventdefault(e)
                     doStuff();
         }
    });  

 

Many thanks,

Jeff

0
Ivan Danchev
Telerik team
answered on 12 Jul 2017, 01:53 PM
Hi Jeff,

The Spreadsheet performs the undo/redo actions prior to this code being executed:
if (e.ctrlKey && e.keyCode == 90) {
         preventdefault(e)
         doStuff();
}
// Ctrl Y
else if (e.ctrlKey && e.keyCode == 89) {
         preventdefault(e)
         doStuff();
}
thus preventing the event does not have the expected effect. At present a Spreadsheet event that would give you control over these actions is not exposed.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jeffrey
Top achievements
Rank 1
answered on 19 Jul 2017, 10:29 PM

Hi,

 

When you say that the event that gives control over these actions is not exposed, you mean that we cannot customize it at all right?  However, would it be possible rather than customizing the undo event for us to instead simply completely remove the undo/redo keyboard shortcuts functionality?

 

Thanks,

Jeff

0
Ivan Danchev
Telerik team
answered on 21 Jul 2017, 12:08 PM
Hello Jeff,

I meant that by the time $(document).keydown(function(e) { ... }); fires the Spreadsheet has executed the undo/redo operation internally and that it does not expose a specific event in its API related to the undo/redo functionality that you can handle/prevent. There is no configuration options for enabling/disabling the triggering of the undo/redo operations with the keyboard, thus achieving this would require modifying the source code.

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