Spreadsheet history
All important changes in the spreadsheet are tracked under the History internal container. From version 8 on, the history is one array shared for all worksheets. In this section, we provide a few more details about the spreadsheet changes tracker.Documentation
Methods
The undo and redo methods are normally invoked by the CTRL+Z, CTRL+Y keyboard shortcut. The following methods can be called programmatically, as follows:Method | Description |
---|---|
undo() | Undo the last spreadsheet changes.undo() : void |
redo() | Redo the most recent spreadsheet changes.redo() : void |
setHistory(object) | Redo the most recent spreadsheet changes.setHistory(history: Object) : void |
resetHistory() | Redo the most recent spreadsheet changes.resetHistory() : void |
Events
Events related to the history changes tracker.Event | Description |
---|---|
onredo | onredo(worksheet: Object, info: Object) : null The info array contains all necessary information about the history and depends on which change was performed. |
onundo | onundo(worksheet: Object, info: Object) : null The info array contains all necessary information about the history and depends on which change was performed. |
Example
As explained above, the history actions are available on the spreadsheet level.<html> <script src="https://jspreadsheet.com/v9/jspreadsheet.js"></script> <script src="https://jsuites.net/v5/jsuites.js"></script> <link rel="stylesheet" href="https://jspreadsheet.com/v9/jspreadsheet.css" type="text/css" /> <link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" /> <div id='spreadsheet'></div> <input type="button" value="Undo" onclick="spreadsheet[0].parent.undo()"> <input type="button" value="Redo" onclick="spreadsheet[0].parent.undo()"> <input type="button" value="Reset" onclick="spreadsheet[0].parent.resetHistory()"> <script> // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('MjY3MGZiNTdhMDNlNzQ5MjQ4ZjM4M2RhYTUzN2FhMGQ1MTNiNTEyODRkZmExOTRkZmRhMzEyMGYzZDEwNzIzM2IxMzYyNjhkYjkzZDA1MTA1M2VjMjcwMTIxMjZiYjRmNTgwMzQ4ZjMxNGQyZGQ5N2Q3MTQ4YjIyM2E2MTllZmQsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3dNak0zTURRNE15d2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5'); // Create the spreadsheet var spreadsheet = jspreadsheet(document.getElementById('spreadsheet'), { worksheets: [{ minDimensions: [8, 8], }], }); </script> </html>