-1

i am using Kendo UI Tree for the purpose of drag and drop between two trees.

i am filling it using ajax call.

now the issue is i can find the source and destination of the node when i moved any item from TreeViewA to itself but when i drag and drop item from TreeViewA to TreeViewB i can't find source and destination nodes ids.

Please Help!

Plus can i drag and drop source item copy not removing node from the source.

Syeda
  • 1,215
  • 11
  • 23
  • hey @Syeda look at [drag and drop without remove item source](http://www.telerik.com/forums/re-two-trees----allowing-the-drop-but-preventing-the-draggable-from-moving#2z382UEs3ke97ZvdV5MOyg) from Telerik Forums – maliness Sep 22 '15 at 11:57

1 Answers1

2

When you have two trees, you can get access to the nodes and their data in the following way (defining the drop function):

, drop: function (e) {
    if (e.valid) {
    var theOtherTree = $(e.dropTarget).parents('.k-treeview').data("kendoTreeView");
    console.log('drop source: ' + this.dataItem(e.sourceNode).customData);
    console.log('drop target: ' + theOtherTree.dataItem(e.dropTarget).customData);
    }
}
  • "this" refers to the source tree, and the target tree is obtained through the dropTarget
  • you can retrieve id, or whatever custom data in the node you want.
Miika L.
  • 3,333
  • 1
  • 24
  • 35