Undo for Data Components

While working with Webix data components, you can enable the undo functionality that allows reverting changes in case server returns an error message.

The undo operation can be applied to any DataStore-based component.

To enable undo, you need to set the undo parameter to true in the configuration of the component:

webix.ui({
    view:"list",
    id:"mylist",
    template:"#title#", 
    data:dataset
    undo:true
});

The undo API includes three methods:

  • undo - reverts the previously made change in the component.
$$("mylist").undo();

For example, if you add an item into the component, then change it and finally decide to delete it, a call of the undo() method will revert just the result of the delete operation.

If you want to delete all the changes made to an item and set it to the initial state, you should pass the id of this item to the undo() method.

  • removeUndo - removes history about all the operations made to an item.
$$("mylist").removeUndo(id);

As a parameter the method takes the id of an item.

  • ignoreUndo - calls a function that will be ignored in the undo history track. The method is useful if you want the applied changes not to be reverted by the undo() method in future.
$$("mylist").ignoreUndo(function(){
    $$("mylist").addItem({...});
});

The ignoreUndo() method takes as a parameter the function for which undo history track should be disabled.

Back to top