drag-task
Description
Fires when dragging a taskUsage
"drag-task": ({
id: string | number;
width?: number;
left?: number;
top?: number;
}) => boolean|void;
Parameters
The callback of the drag-task action takes an object with the following parameters:
id
- (required) an ID of the task that is draggedwidth
- (optional) specifies the value (in pixels) by which the task width has changed during draggingleft
- (optional) specifies the number of pixels the task was dragged to the lefttop
- (optional) specifies the number of pixels the task was dragged to the top
Example
<script>
import { getData } from "./common/data";
import { Gantt } from "@wx/svelte-gantt";
const data = getData();
let api;
$: if (api) {
api.on("drag-task", ev => {
console.log("The id of the dragged task:" (ev.id));
});
}
</script>
<Gantt
bind:api
tasks={data.tasks}
links={data.links}
//other settings />
Related articles: