The onLinkCreate event handler fires when the user finishes creating a link using drag and drop, before the default action configured by linkCreateHandling.
DayPilot.Scheduler.onLinkCreate(args)args.from (string | number) - source event ID
args.to (string | number) - target event ID
args.type (string) - link type ("StartToStart", "StartToFinish", "FinishToStart", "FinishToFinish")
args.preventDefault() - cancels the default action
Use this event when you need to validate or replace the built-in link creation behavior before it runs. Calling args.preventDefault() stops the action specified by linkCreateHandling.
JavaScript
const dp = new DayPilot.Scheduler("dp", {
onLinkCreate: (args) => {
dp.message("Link created, type: " + args.type);
},
// ...
});
dp.init();Angular
<daypilot-scheduler [config]="config"></daypilot-scheduler>config: DayPilot.SchedulerConfig = {
onLinkCreate: (args) => {
console.log(args.from, args.to, args.type);
},
// ...
};React
<DayPilotScheduler
onLinkCreate={onLinkCreate}
{/* ... */}
/>const onLinkCreate = (args) => {
console.log(args.from, args.to, args.type);
};Vue
<DayPilotScheduler
@linkCreate="onLinkCreate"
<!-- ... -->
/>const onLinkCreate = (args) => {
console.log(args.from, args.to, args.type);
};DayPilot.Scheduler.linkCreateHandling