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/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v9/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://jsuites.net/v4/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('MDYxNWJkZjM0NDYzZjY1OTVkZjlmNjc3ZmVkOWUzNGM4ZWVkNjMxNzUzMDBjZTI5ZWIxOGQ3YTVhZjdjMGNkZWZlOGVkMTIyNWNhZTg2MDJlMjM1YmUxYThlYjY3NDQzNjA5MGI2NTkyOTgwOWE1ZDMxMzlmZGM4YmE1Yjk4ZDIsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UWTNNRFkyTVRFek15d2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpJaXdpYzJOdmNHVWlPbHNpZGpjaUxDSjJPQ0lzSW5ZNUlpd2lZMmhoY25Seklpd2labTl5YlhNaUxDSm1iM0p0ZFd4aElpd2ljR0Z5YzJWeUlpd2ljbVZ1WkdWeUlpd2lZMjl0YldWdWRITWlMQ0pwYlhCdmNuUWlMQ0ppWVhJaUxDSjJZV3hwWkdGMGFXOXVjeUlzSW5ObFlYSmphQ0pkTENKa1pXMXZJanAwY25WbGZRPT0=');

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



Create applications with spreadsheet-like controls