Skip to main content

undo

PRO

The functionality is available in PRO Edition only

Description​

Allows performing steps back in history

It's required to enable the undo property to perfrom the action.

Actions that can be undone: add-task, update-task, add-link, update-link, delete-task, delete-link, move-task, copy-task.

Hot key for the action: Ctrl/Meta + Z

Usage​

"undo": () => void;

Parameters​

The callback of the action takes no parameters.

Example​

We enable the undo action on a button click.

<script>
import { Gantt } from "@svar/svelte-gantt";
import { Button } from "@svar-ui/svelte-core";
import { getData } from "../data";

const { tasks, links } = getData();

let api = $state();

function undo() {
api.exec("undo");
}
</script>

<Button onclick={undo}>Undo</Button>
<Gantt bind:this={api} {tasks} {links} undo />

Related samples:

Related articles: