The contextMenuLink property (DayPilot.Menu) defines the commands shown for dependency links in the Scheduler.
Declaration
DayPilot.Scheduler.contextMenuLinkDefault Value
nullNotes
Assign a DayPilot.Menu instance to customize the actions available for a clicked event link.
Menu item handlers can inspect the clicked link using args.source, including the link ID from args.source.data.id, and they can remove the link using scheduler.links.remove(args.source).
Examples
JavaScript
const scheduler = new DayPilot.Scheduler("dp", {
contextMenuLink: new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
scheduler.links.remove(args.source);
}
}
]
}),
// ...
});
gantt.init();Angular
<daypilot-scheduler [config]="config"></daypilot-scheduler>config: DayPilot.SchedulerConfig = {
contextMenuLink: new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
this.scheduler.control.links.remove(args.source);
}
}
]
}),
// ...
};React
<DayPilotScheduler
contextMenuLink={contextMenuLink}
{/* ... */}
/>const contextMenuLink = new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
scheduler.links.remove(args.source);
}
}
]
});Vue
<DayPilotScheduler
:contextMenuLink="contextMenuLink"
<!-- ... -->
/>const contextMenuLink = new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
scheduler.links.remove(args.source);
}
}
]
});See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot