request-data
Description
Fires when data for a task branch is requestedUsage
"request-data": ({
id: string
}) => boolean | void;
Parameters
The callback of the request-data action 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, useRef } from "react";
import { getData } from "./common/data";
import { Gantt } from "wx-react-gantt";
import "wx-react-gantt/dist/gantt.css";
const GanttComponent = () => {
const apiRef = useRef();
const data = getData();
useEffect(() => {
if (apiRef.current) {
apiRef.current.on("request-data", ({ id }) => {
console.log("Data request for: " + id);
});
}
}, [apiRef.current]);
return (
<Gantt
apiRef={apiRef}
tasks={data.tasks}
//other settings
/>
);
};
export default GanttComponent;
Related articles: How to access Gantt API