The contextMenuRow property (DayPilot.Menu) defines the commands shown for Gantt rows.
DayPilot.Gantt.contextMenuRow
null
Assign a DayPilot.Menu instance to customize the actions available for a clicked row.
Menu item handlers can inspect the clicked row task using args.source, including the task ID from args.source.id(), and they can remove the task using gantt.tasks.remove(args.source).
const gantt = new DayPilot.Gantt("dp", {
contextMenuRow: new DayPilot.Menu({
items: [
{
text: "Show task ID",
onClick: args => {
alert("Task ID: " + args.source.id());
}
},
{
text: "Delete task",
onClick: args => {
gantt.tasks.remove(args.source);
}
}
]
}),
// ...
});
gantt.init();
<daypilot-gantt [config]="config"></daypilot-gantt>
config: DayPilot.GanttConfig = {
contextMenuRow: new DayPilot.Menu({
items: [
{
text: "Show task ID",
onClick: args => {
alert("Task ID: " + args.source.id());
}
},
{
text: "Delete task",
onClick: args => {
this.gantt.control.tasks.remove(args.source);
}
}
]
}),
// ...
};
<DayPilotGantt
contextMenuRow={contextMenuRow}
{/* ... */}
/>
const contextMenuRow = new DayPilot.Menu({
items: [
{
text: "Show task ID",
onClick: args => {
alert("Task ID: " + args.source.id());
}
},
{
text: "Delete task",
onClick: args => {
gantt.tasks.remove(args.source);
}
}
]
});
<DayPilotGantt :contextMenuRow="contextMenuRow" <!-- ... --> />
const contextMenuRow = new DayPilot.Menu({
items: [
{
text: "Show task ID",
onClick: args => {
alert("Task ID: " + args.source.id());
}
},
{
text: "Delete task",
onClick: args => {
gantt.tasks.remove(args.source);
}
}
]
});