This is a migrated thread and some comments may be shown as answers.

Treeview Drag and Drop from Grid

3 Answers 229 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 24 Mar 2015, 09:51 PM
I am dragging and dropping from a grid and it is working fine.  I just have one question.

If I drag from one treeview to another treeview, I can grab a node from one and when I hover over the second treeview, I have the ability to position the node I am dropping in several locations.  I can either drop it on another node, or I can drop it before or after nodes.

If I drag from a grid, I don't have that ability.  What would I need to do to enable that ability?

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 26 Mar 2015, 01:13 PM

Hello Brian,

To exactly specify where the item will be dropped, you will need to introduce a field that sets the item ordering, and set this field in the data item prior to inserting, based on the drop event handler. You would also need to enforce that the dataSource is sorted by that field.

If you do not need the ordering field in your business layer (i.e. ordering the items is only meant to serve as feedback for the user), you may pop a status message that the operation was successful.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Brian
Top achievements
Rank 1
answered on 26 Mar 2015, 02:12 PM
I don't think that is quite what I meant.  If you go to the demo found at http://demos.telerik.com/kendo-ui/treeview/dragdrop and drag a node from one tree to the other (or even if you just drag a node to another spot in the same treeview), you get a little line to show that you can drop a node in front of another node or after another node.  

But, if I drag from a grid to a treeview, I can only drop on another node.

I would like the same functionality if I am dragging from a grid as I have when dragging from another tree.
0
Alex Gyoshev
Telerik team
answered on 30 Mar 2015, 06:36 AM

Hello Brian,

I'm afraid that this is functionality that is specific to the TreeView, as it preserves the ordering of items. You can provide any cues to the user by handling the drag event and determining your action based on the event arguments. You can see how this behavior is implemented in the TreeView at the end of the src/kendo.treeview.js file. There are two types of cues provided -- the drop line and the drop status -- the second can be easily customized via the e.setStatusClass method, and providing additional cues is up to custom code.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Brian
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Brian
Top achievements
Rank 1
Share this question
or