dragstart

Triggered before the dragging of a node starts.

Event Data

e.sourceNode Element

The node that will be dragged.

Example - subscribe to the "dragstart" event during initialization

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dragAndDrop: true,
  dataSource: [
    { text: "foo", items: [
      { text: "bar" }
    ] }
  ],
  dragstart: function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log("Drag start", e.sourceNode);
  }
});
</script>

Example - subscribe to the "dragstart" event after initialization

<div id="treeview"></div>
<script>
function tree_dragstart(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log("Drag start", e.sourceNode);
}
$("#treeview").kendoTreeView({
  dragAndDrop: true,
  dataSource: [
    { text: "foo", items: [
      { text: "bar" }
    ] }
  ]
});
var treeview = $("#treeview").data("kendoTreeView");
treeview.bind("dragstart", tree_dragstart);
</script>

Example - disable dragging of root nodes

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dragAndDrop: true,
  dataSource: [
    { text: "foo", items: [
      { text: "bar" }
    ] }
  ],
  dragstart: function(e) {
    if ($(e.sourceNode).parentsUntil(".k-treeview", ".k-item").length == 0) {
      e.preventDefault();
    }
  }
});
</script>
In this article