Skip to main content

copy-task

Description

Fires when copying a task

Usage

"copy-task": ({
id: string | number,
target: string | number,
mode: string
}) => boolean|void;

Parameters

The callback of the copy-task action can take an object with the following parameters:

  • id - (required) the ID of the copied task
  • target - (required) the task ID before or after which a new task will be copied to
  • mode - (required) specifies where to place a task: before - before the task which id is specified or after it (after)

Example

<script>
import { getData } from "./common/data";
import { Gantt } from "@wx/svelte-gantt";

const data = getData();
let api;

$: if (api) {
api.on("copy-task", ev => {
console.log("The id of the copied task:" (ev.id));
});
}

</script>

<Gantt
bind:api
tasks={data.tasks}
//other settings />

Related articles: