indent-task
Description
Fires when indenting a taskUsage
"indent-task": ({
id: string | number,
mode: boolean
}) => boolean|void;
Parameters
The callback of the indent-task action can take an object with the following parameters:
id
- (required) the ID of the indented taskmode
- (boolean) if true, a task becomes a child of the task above
info
For handling the actions you can use the Event Bus methods
Example
import React, { useRef, useEffect } from "react";
import { getData } from "./common/data";
import { Gantt } from "wx-react-gantt";
import "wx-react-gantt/dist/gantt.css";
const App = () => {
const data = getData();
const apiRef = useRef(null);
useEffect(() => {
if (apiRef.current) {
apiRef.current.exec("indent-task", {
id: 3,
mode: true,
});
}
}, [apiRef.current]);
return (
<Gantt
apiRef={apiRef}
tasks={data.tasks}
//other settings
/>
);
};
export default App;
Related articles: How to access Gantt API