DayPilot.Gantt.contextMenuLink

The contextMenuLink property (DayPilot.Menu) defines the commands shown for dependency links in the Gantt chart.

Declaration

DayPilot.Gantt.contextMenuLink

Default Value

null

Notes

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).

Examples

JavaScript

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();

Angular

<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);
        }
      }
    ]
  }),
  // ...
};

React

<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);
      }
    }
  ]
});

Vue

<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);
      }
    }
  ]
});

See Also

DayPilot.Menu Class

DayPilot.Gantt Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript