remove

Fired when a task or a dependency is about to be removed.

The event handler function context (available via the this keyword) will be set to the widget instance.

Event Data

e.task kendo.data.GanttTask

The GanttTask instance which is being removed the DataSource.

e.dependencies Array

An array of GanttDependency instances which are associated with the task being removed, or an array with a single dependency which is being removed.

e.preventDefault Function

If invoked prevents the remove action.

e.sender kendo.ui.Gantt

The widget instance which fired the event.

Example - subscribe to the "remove" event during initialization

<div id="gantt"></div>
<script>
$("#gantt").kendoGantt({
  dataSource: [
    {
      id: 1,
      orderId: 0,
      parentId: null,
      title: "Task1",
      start: new Date("2014/6/17 11:00"),
      end: new Date("2014/6/17 14:00")
    },
    {
      id: 2,
      orderId: 1,
      parentId: null,
      title: "Task2",
      start: new Date("2014/6/17 15:00"),
      end: new Date("2014/6/17 16:00")
    }
  ],
  dependencies: [
    {
      predecessorId: 1,
      successorId: 2,
      type: 1,
      id: 0
    }
  ],
  remove: function(e) {
    if (e.task) {
      console.log("Removing task:", e.task.title);
      console.log(kendo.format("Removing {0} related dependencies", e.dependencies.length));
    } else {
      console.log("Removing dependency with id:", e.dependencies[0].id);
    }
  }
});
</script>

Example - subscribe to the "remove" event after initialization

<div id="gantt"></div>
<script>
function gantt_remove(e) {
  if (e.task) {
    console.log("Removing task:", e.task.title);
    console.log(kendo.format("Removing {0} related dependencies", e.dependencies.length));
  } else {
    console.log("Removing dependency with id:", e.dependencies[0].id);
  }
}
$("#gantt").kendoGantt({
  dataSource: [
    {
      id: 1,
      orderId: 0,
      parentId: null,
      title: "Task1",
      start: new Date("2014/6/17 11:00"),
      end: new Date("2014/6/17 14:00")
    },
    {
      id: 2,
      orderId: 1,
      parentId: null,
      title: "Task2",
      start: new Date("2014/6/17 15:00"),
      end: new Date("2014/6/17 16:00")
    }
  ],
  dependencies: [
    {
      predecessorId: 1,
      successorId: 2,
      type: 1,
      id: 0
    }
  ]
});
var gantt = $("#gantt").data("kendoGantt");
gantt.bind("remove", gantt_remove);
</script>
In this article
Not finding the help you need?