Skip to main content

api.getTask(id)

Description

Gets an object with the task configuration

Usage

api.getTask(id): ITask;

Parameters

  • id - the id of a task

Returns

The method returns an object with the tasks parameters.

Example of the object that is returned:

{
id: 3,
start: Thu Mar 05 2020 00:00:00 GMT+0300 (Moscow Standard Time),
end: Sat Mar 07 2020 00:00:00 GMT+0300 (Moscow Standard Time),
text: 'Task 3',
progress: 6,
type:"summary",
duration:2,
parent:0
}

Example

The example shows how to output to console data on the task with "id:3".

<script setup>
import { getData } from "../data";
import { Gantt } from "@svar-ui/vue-gantt";

const data = getData();

function init(api) {
const task = api.getTask(3);
console.log("Task:", task);
}
</script>

<template>
<Gantt
:tasks="data.tasks"
:links="data.links"
:scales="data.scales"
:init="init"
/>
</template>

Related articles: