Skip to main content

delete-link

Description

Fires when deleting a link

Usage

"delete-link": ({
id: string | number;
}) => boolean|void;

Parameters

The callback of the delete-link action can take an object with the following parameters:

  • id - (required) the ID of a link to be deleted
info

For handling the actions you can use the Event Bus methods

Example

import { useEffect, useRef } from "react";
import { getData } from "./common/data";
import { Gantt } from "wx-react-gantt";

const data = getData();

function GanttComponent() {
const apiRef = useRef();

useEffect(() => {
if (apiRef.current) {
apiRef.current.on("delete-link", (ev) => {
console.log("The id of the deleted link:", ev.id);
});
}
}, [apiRef.current]);

return (
<Gantt
apiRef={apiRef}
tasks={data.tasks}
links={data.links}
//other settings
/>
);
}

export default GanttComponent;

Related articles: How to access Gantt API