The onLinkCreate event handler fires when the user finishes creating a link using drag and drop, before the default action configured by linkCreateHandling.
Declaration
DayPilot.Scheduler.onLinkCreate(args)Parameters
args.from(string | number) - source event IDargs.to(string | number) - target event IDargs.type(string) - link type ("StartToStart","StartToFinish","FinishToStart","FinishToFinish")args.preventDefault()- cancels the default action
Notes
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.
Examples
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);
};See Also
DayPilot.Scheduler.linkCreateHandling
DayPilot.Scheduler.onLinkCreated
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot