This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# UndoRedo

# Description

Handsontable UndoRedo plugin allows to undo and redo certain actions done in the table.

Note, that not all actions are currently undo-able. The UndoRedo plugin is enabled by default.

Example

undo: true

# Options

# undo

Source code (opens new window)

undoRedo.undo : boolean

The undo option configures the UndoRedo plugin.

You can set the undo option to one of the following:

Setting Description
true Enable the UndoRedo plugin
false Disable the UndoRedo plugin

By default, the undo option is set to undefined, but the UndoRedo plugin acts as enabled. To disable the UndoRedo plugin completely, set the undo option to false.

Read more:

Default: undefined Example

// enable the `UndoRedo` plugin
undo: true,

# Methods

# clear

Source code (opens new window)

undoRedo.clear()

Clears undo history.

# destroy

Source code (opens new window)

undoRedo.destroy()

Destroys the instance.

# disable

Source code (opens new window)

undoRedo.disable()

Disables the plugin.

# done

Source code (opens new window)

undoRedo.done(wrappedAction, [source])

Stash information about performed actions.

Emits: Hooks#event:beforeUndoStackChange, Hooks#event:afterUndoStackChange, Hooks#event:beforeRedoStackChange, Hooks#event:afterRedoStackChange

Param Type Description
wrappedAction function The action descriptor wrapped in a closure.
[source] string optional Source of the action. It is defined just for more general actions (not related to plugins).

# enable

Source code (opens new window)

undoRedo.enable()

Enables the plugin.

# isEnabled

Source code (opens new window)

undoRedo.isEnabled() ⇒ boolean

Checks if the plugin is enabled.

# isRedoAvailable

Source code (opens new window)

undoRedo.isRedoAvailable() ⇒ boolean

Checks if redo action is available.

Returns: boolean - Return true if redo can be performed, false otherwise.

# isUndoAvailable

Source code (opens new window)

undoRedo.isUndoAvailable() ⇒ boolean

Checks if undo action is available.

Returns: boolean - Return true if undo can be performed, false otherwise.

# redo

Source code (opens new window)

undoRedo.redo()

Redo the previous action performed to the table (used to reverse an undo).

Emits: Hooks#event:beforeUndoStackChange, Hooks#event:afterUndoStackChange, Hooks#event:beforeRedoStackChange, Hooks#event:afterRedoStackChange, Hooks#event:beforeRedo, Hooks#event:afterRedo

# undo

Source code (opens new window)

undoRedo.undo()

Undo the last action performed to the table.

Emits: Hooks#event:beforeUndoStackChange, Hooks#event:afterUndoStackChange, Hooks#event:beforeRedoStackChange, Hooks#event:afterRedoStackChange, Hooks#event:beforeUndo, Hooks#event:afterUndo

Last Updated: Apr 12, 2024