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:
MethodDescription
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.
EventDescription
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('ZDg1ZmQ4ZmJlZGRhMThmNzcwZDhhMGMwOGRmOGM1NTNmZmE4NjRhZjNmZTkwY2NkMDI5MmIwY2FjMjU1YmExOTkxN2Y0YjJkYjQyZGYyODE1YTNjMDFjY2JjZjEzZTIwMDRlZDAyNzAwYjhjOGEzNjgzMjQ2YTc1MzNjZmM0ZjQsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3hNRGt4TURVME1pd2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Create the spreadsheet
var spreadsheet = jspreadsheet(document.getElementById('spreadsheet'), {
    worksheets: [{
        minDimensions: [8, 8],
    }],
});
</script>
</html>