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('Nzk2Y2U4NDFkNzk3OTY5NTc2NmFmMThmMGI1YmJkMmVmNGNjNzJjZDRkNTQzZTRlMDBmNWI5ODg0YmEwN2M1ZWY3ZThlZDJiMWE2Nzk4NDY5NTE1OWFkOTc3MzE0YTI0ZjkzMjI4YmRjZjA1OWM4NWUyOGVjYjlmZTcwZjAwMGUsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UWTVOalV3TkRVNU1Td2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owSWl3aVltRnlJaXdpZG1Gc2FXUmhkR2x2Ym5NaUxDSnpaV0Z5WTJnaUxDSndjbWx1ZENJc0luTm9aV1YwY3lKZExDSmtaVzF2SWpwMGNuVmxmUT09'); // Create the spreadsheet var spreadsheet = jspreadsheet(document.getElementById('spreadsheet'), { worksheets: [{ minDimensions: [8, 8], }], }); </script> </html>