Skip to main content

undo

The functionality is available in PRO Edition onlyPRO

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 + 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 articles: