Spreadsheet Clear Undo/Redo History

6 posts, 0 answers
  1. Jeffrey
    Jeffrey avatar
    14 posts
    Member since:
    Sep 2016

    Posted 30 Jun 2017 Link to this post

    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

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2062 posts

    Posted 04 Jul 2017 Link to this post

    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.
  3. Jeffrey
    Jeffrey avatar
    14 posts
    Member since:
    Sep 2016

    Posted 10 Jul 2017 Link to this post

    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

  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2062 posts

    Posted 12 Jul 2017 Link to this post

    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.
  5. Jeffrey
    Jeffrey avatar
    14 posts
    Member since:
    Sep 2016

    Posted 19 Jul 2017 Link to this post

    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

  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2062 posts

    Posted 21 Jul 2017 Link to this post

    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.
Back to Top