The contextMenuLink property (DayPilot.Menu) defines the commands shown for dependency links in the Gantt chart.
DayPilot.Gantt.contextMenuLink
null
Assign a DayPilot.Menu instance to customize the actions available for a clicked dependency 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 gantt.links.remove(args.source).
const gantt = new DayPilot.Gantt("dp", {
contextMenuLink: new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
gantt.links.remove(args.source);
}
}
]
}),
// ...
});
gantt.init();
<daypilot-gantt [config]="config"></daypilot-gantt>
config: DayPilot.GanttConfig = {
contextMenuLink: new DayPilot.Menu({
items: [
{
text: "Show link ID",
onClick: args => {
alert("Link ID: " + args.source.data.id);
}
},
{
text: "Delete link",
onClick: args => {
this.gantt.control.links.remove(args.source);
}
}
]
}),
// ...
};
<DayPilotGantt
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 => {
gantt.links.remove(args.source);
}
}
]
});
<DayPilotGantt :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 => {
gantt.links.remove(args.source);
}
}
]
});