Skip to main content

api.serialize()

Description

Serilizes and returns the list of current tasks in Gantt

Serializes and returns the list of current tasks in Gantt.

Usage

api.serialize(): ITask[];

Returns

Returns an array of current tasks in Gantt: ITask[]. Each element in the array is the tasks object.

Example

The example shows how to serialize tasks and output them to console:

import { getData } from "../data";
import { Gantt } from "@svar-ui/react-gantt";

const data = getData();

function init(api) {
const tasks = api.serialize();
console.log("Serialized tasks:", tasks);
}

export default function App() {
return (
<Gantt
tasks={data.tasks}
links={data.links}
init={init}
/>
);
}

Related articles: