api.getTable()
Description
Gets the Table API instanceTable API provides control over the Table component associated with the Gantt chart.
Usage
getTable: (waitRender?: boolean, section?: "grid" | "subGrid") => Promise<ITableApi> | ITableApi;
Parameters
waitRender- iftrue, returns aPromisethat resolves once the Table API is fully initialized;falseis set by default (returns the API synchronously when possible).section- the grid to take the API from: "grid" (default) for the grid on the left of the chart, "subGrid" for the Subgrid on the right of the chart | PRO feature
Returns
Depending on the waitRender parameters and initialization stage, the method returns: ITableApi|Promise
Example
Waiting for initialization:
<script setup>
import { getData } from "../data";
import { Gantt } from "@svar-ui/vue-gantt";
const { tasks, links } = getData();
function init(api) {
api.getTable(true).then((tableApi) => {
console.log("Table API:", tableApi);
});
}
</script>
<template>
<Gantt :init="init" :tasks="tasks" :links="links" />
</template>
Getting the API of the Subgrid:
const table = await api.getTable(true, "subGrid");
Related articles: