api.setNext()
Description
Allows adding some action into the Event Bus orderUsage
api.setNext(next: any): void;
Parameters
next- (required) the action to be included into the Event Bus order
Example
You need to include RestDataProvider into the Event Bus order to perform operations with tasks and send the corresponding requests to the server.
Example:
<script setup>
import { Gantt } from "@svar-ui/vue-gantt";
import { RestDataProvider } from "@svar-ui/gantt-data-provider";
import { getData } from "./common/data";
import { ref } from "vue";
const data = getData();
const url = "https://some_backend_url";
const server = new RestDataProvider(url);
const tasks = ref([]);
const links = ref([]);
server.getData().then(data => {
tasks.value = data.tasks;
links.value = data.links;
});
function init(api) {
api.setNext(server);
}
</script>
<template>
<Gantt
:tasks="tasks"
:links="links"
:init="init" />
</template>
Related articles: