Skip to main content

update-link

Description

Fires when updating a link

Usage

"update-link": ({
id: string | number,
link: any
}) => boolean | void;

Parameters

The callback of the update-link action can take an object with the following parameters:

  • id - (required) the id of a link
  • link - (required) an object with the link data:
    • source - (required) the source task ID
    • target - (required) the target task ID
    • type - (required) the link type; possible link type values:
       - 0 - "End-to-start" 
      - 1 - "Start-to-start"
      - 2 - "End-to-end"
      - 3 - "Start-to-end"
info

For handling the actions you can use the Event Bus methods

Example

In the example below we apply the api.exec method to trigger the action with a button click:

<script>
import { getData } from "./common/data";
import { Gantt } from "wx-svelte-gantt";
import { Button } from "wx-svelte-wx";

const data = getData();

let api;

const updateLink = () => {
api.exec("update-link", {
id: 1,
link: { type: 3 }
});
};

</script>

<Button click={updateLink} type="primary">Update Link</Button>

<Gantt
bind:api
tasks={data.tasks}
links={data.links}
//other settings />

Related articles: How to access Gantt API