undo
Description
Allows performing steps back in historyIt'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: