You can use the Scheduler API to manage links programmatically:
links.load() - load links from a remote URL (see also link loading)
links.add() - create a new link programmatically
links.remove() - delete a link programmatically
links.find() - find a link data object using its ID
links.findByFromTo() - find a link connecting two events
API: links.find, links.add.
The Connect tasks button checks for link ID L1 before adding it, so repeated clicks do not create duplicate dependencies.
The framework examples use DayPilot Pro. For installation, see the Angular, React or Vue Scheduler guide.
Angular
Access links.find() and links.add() through this.scheduler.control in the button method.
import {Component, ViewChild} from "@angular/core";
import {DayPilot, DayPilotModule, DayPilotSchedulerComponent} from "daypilot-pro-angular";
@Component({
selector: "app-scheduler-example",
standalone: true,
imports: [DayPilotModule],
template: `
<button (click)="action0()">Connect tasks</button>
<daypilot-scheduler [config]="config" #scheduler></daypilot-scheduler>
`
})
export class SchedulerExampleComponent {
@ViewChild("scheduler") scheduler!: DayPilotSchedulerComponent;
config: DayPilot.SchedulerConfig = {
startDate: "2026-11-01",
days: 30,
scale: "Day",
timeHeaders: [{groupBy: "Month"}, {groupBy: "Day", format: "d"}],
resources: [{id: "A", name: "Room A"}, {id: "B", name: "Room B"}],
events: [{id: 1, text: "Planning", resource: "A", start: "2026-11-03", end: "2026-11-06"}, {id: 2, text: "Delivery", resource: "B", start: "2026-11-08", end: "2026-11-11"}]
};
async action0() {
const dp = this.scheduler.control;
if (!dp.links.find("L1")) { dp.links.add({id: "L1", from: 1, to: 2, type: "FinishToStart"}); }
}
}
React
The controlRef callback supplies the Scheduler API; keep it in useRef for the button handler.
import React, {useRef} from "react";
import {DayPilot, DayPilotScheduler} from "daypilot-pro-react";
export default function SchedulerExample() {
const scheduler = useRef(null);
async function action0() {
const dp = scheduler.current;
if (!dp.links.find("L1")) { dp.links.add({id: "L1", from: 1, to: 2, type: "FinishToStart"}); }
}
return <div>
<button onClick={action0}>Connect tasks</button>
<DayPilotScheduler
controlRef={control => { scheduler.current = control; }}
startDate={"2026-11-01"}
days={30}
scale={"Day"}
timeHeaders={[{groupBy: "Month"}, {groupBy: "Day", format: "d"}]}
resources={[{id: "A", name: "Room A"}, {id: "B", name: "Room B"}]}
events={[{id: 1, text: "Planning", resource: "A", start: "2026-11-03", end: "2026-11-06"}, {id: 2, text: "Delivery", resource: "B", start: "2026-11-08", end: "2026-11-11"}]}
/>
</div>;
}
Vue
The component's template ref exposes scheduler.value.control. Use its links API from the script's click function.
<script setup>
import {ref} from "vue";
import {DayPilot, DayPilotScheduler} from "daypilot-pro-vue";
const scheduler = ref(null);
const startDate = "2026-11-01";
const days = 30;
const scale = "Day";
const timeHeaders = [{groupBy: "Month"}, {groupBy: "Day", format: "d"}];
const resources = [{id: "A", name: "Room A"}, {id: "B", name: "Room B"}];
const events = [{id: 1, text: "Planning", resource: "A", start: "2026-11-03", end: "2026-11-06"}, {id: 2, text: "Delivery", resource: "B", start: "2026-11-08", end: "2026-11-11"}];
async function action0() {
const dp = scheduler.value.control;
if (!dp.links.find("L1")) { dp.links.add({id: "L1", from: 1, to: 2, type: "FinishToStart"}); }
}
</script>
<template>
<div>
<button @click="action0">Connect tasks</button>
<DayPilotScheduler ref="scheduler"
:startDate="startDate"
:days="days"
:scale="scale"
:timeHeaders="timeHeaders"
:resources="resources"
:events="events"
/>
</div>
</template>
Availability
Availability of this feature in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript | ||
| DayPilot for ASP.NET WebForms | ||
| DayPilot for ASP.NET MVC | ||
| DayPilot for Java |
DayPilot