collapse
Triggered before a subgroup gets collapsed.

Event data

node : Node
The collapsed node
drag
Triggered while a node is being dragged.

Show the user that is not permitted to drop nodes outside of the #drop-area element

treeview.data("kendoTreeView").bind("drag", function(e) {
    if ($(e.dropTarget).parents("#drop-area").length ) {
        e.setStatusClass("k-denied");
    }
});

Event data

sourceNode : Node
The node that is being dragged.
dropTarget : Element
The element that the node is placed over.
pageX : Number
The x coordinate of the mouse.
pageY : Number
The y coordinate of the mouse.
statusClass : String
The status that the drag clue shows.
setStatusClass : Function
Allows a custom drag clue status to be set.

Pre-defined status classes are:

  • k-insert-top - Indicates that the item will be inserted on top.
  • k-insert-middle - Indicates that the item will be inserted in the middle.
  • k-insert-bottom - Indicates that the item will be inserted at the bottom.
  • k-add - Indicates that the item will be added/appended.
  • k-denied - Indicates an invalid operation. Using this class will automatically make the drop operation invalid, so there will be no need to call setValid(false) in the drop event.
dragend
Triggered after a node has been dropped.

Event data

sourceNode : Node
The node that is being dropped.
destinationNode : Node
The node that the sourceNode is being dropped upon.
dropPosition : String
Shows where the source has been dropped. One of the values over, before, or after.
dragstart
Triggered before the dragging of a node starts.

Disable dragging of root nodes

treeview.data("kendoTreeView").bind("dragstart", function(e) {
    if ($(e.sourceNode).parentsUntil(".k-treeview", ".k-item").length == 0) {
        e.preventDefault();
    }
});

Event data

sourceNode : Node
The node that will be dragged.
drop
Triggered when a node is being dropped.

Event data

sourceNode : Node
The node that is being dropped.
destinationNode : Node
The node that the sourceNode is being dropped upon.
valid : Boolean
Whether this drop operation is permitted.
setValid : Function
Allows the drop to be prevented.
dropTarget : Element
The element that the node is placed over.
dropPosition : String
Shows where the source will be dropped. One of the values over, before, or after.
expand
Triggered before a subgroup gets expanded.

Event data

node : Node
The expanded node
select
Triggered when a node gets selected.

Event data

node : Node
The selected node