Show / Hide Table of Contents

Undo/Redo

This is used if you've made a mistake or by any other reason you want to undo the changes you have made. You can undo and redo many actions in Org Chart JS and you have a counters for both. Evey undo/redo action is saved in the Window sessionStorage property and can be saved in the database too.

How to add undo/redo buttons:

You just need to add the undoRedoStorageName property in the configuration with a string value, that will be the name of the storage:

 
    let chart = new OrgChart(document.getElementById("tree"), {
        undoRedoStorageName: 'myStorageName',
        ... 
    });
    

How to update the database:

You just need to use the onUpdated method to update the database:

 
   OrgChart.onUpdated(function(args){
        // post config data to your server

        // args.config.nodes
        // args.config.clinks
        ...
   });
    

UI customization:

You can use the onChange method to crete your own UI.
Here is a code demo: