request-data
Description
Fires when data for a task branch is requestedUsage
"request-data": ({
id: string | number
}) => boolean | void;
Parameters
The callback of the request-data event can take an object with the following parameters:
id- (required) the task ID for which data is requested
info
For handling the actions you can use the Event Bus methods
Example
import { useEffect } from "react";
import { getData } from "./common/data";
import { Gantt } from "@svar-ui/react-gantt";
const data = getData();
export default function App() {
function init(api) {
api.on("request-data", ({ id }) => {
console.log("Data request for: " + id);
});
}
return <Gantt tasks={data.tasks} init={init} />;
}
Related articles: How to access Gantt API