Skip to main content

api.exec()

Description​

Allows triggering Gantt actions

Usage​

api.exec(
action: string,
config: object
): void;

Parameters​

  • action - (required) an action to be fired
  • config - (required) the config object with parameters (see the action to be fired)

Actions​

info

The full list of the Gantt actions can be found here

Example​

The example below shows how to clear the task text when opening the Editor dialog for it.

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

const data = getData();

let api;

function clearTaskText() {
api.exec("update-task",
{ id: 3, task: { text: "" }
});
};

</script>

<Gantt tasks={data.tasks} onshoweditor={clearTaskText} bind:this={api} />

Related articles: