Is it possible that I can limit the depth of the subnodes added when dragging a node? For example not to be able to create second level nodes, just root nodes and children to them.
Thanks,
Blagojce
1 Answer, 1 is accepted
0
Alex Gyoshev
Telerik team
answered on 21 Oct 2011, 11:49 AM
Hi Blagojce,
Attach an event handler to the drag event and use the setStatusClass to set the class to k-denied, like so:
$("#treeview-left").data("kendoTreeView").bind("drag", function(e) {
if (e.statusClass != "add") { // the operation is adding, not reordering
return;
}
var isValid = true; // place any custom validation regarding the reordering, using e.sourceNode and e.dropTarget here
if (!isValid) {
e.setStatusClass("k-denied"); // show the "denied" status, that does not allow node drops
}
});
This will provide an intuitive drag clue (showing that the node cannot be dropped there) and an animation when the node is incorrectly dropped.
All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!