delete-task
Description
Fires when deleting a taskUsage
"delete-task": ({
id: string | number,
source?: string | number
}) => boolean|void;
Parameters
The callback of the delete-task action can take an object with the following parameters:
id
- (required) the ID of a task to be deletedsource
- (optional) the ID of a source task that is deleted
info
For handling the actions you can use the Event Bus methods
Example
Use the api.exec
method to trigger the action:
<script>
import { getData } from "./common/data";
import { Gantt } from "wx-svelte-gantt";
import { Button } from "wx-svelte-wx";
const data = getData();
let api;
let selected;
function handleDelete() {
api.exec("delete-task", { id: $selected });
}
</script>
<Toolbar>
{#if $selected}
<Button click={handleDelete}>Delete task</Button>
{/if}
</Toolbar>
<Gantt
bind:api
tasks={data.tasks}
//other settings />
Related articles: How to access Gantt API