The contextMenuRow property (DayPilot.Menu) defines the commands shown for Gantt rows.
Declaration
DayPilot.Gantt.contextMenuRow
Default Value
null
Notes
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).
Examples
JavaScript
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();
Angular
<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);
}
}
]
}),
// ...
};
React
<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);
}
}
]
});
Vue
<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);
}
}
]
});
See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot