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

Sorting using drag drop

1 Answer 17 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Toby
Top achievements
Rank 1
Toby asked on 23 Jan 2018, 04:03 PM

Hi, I have a single tree list which contains several top level nodes, each node has multiple children. What I want to do is to only allow movement of nodes within only within the list of sibling nodes.

The effect that I'm after is something similar to the first animation in https://stackoverflow.com/questions/45838579/separator-line-drag-drop-tree-nodes-c-sharp-winforms.

I have set my tree view AllowDragDrop to true and this allows me to move items around however it is possible to move an existing into a sibling node and generate a sub-tree.

Is this possible and if so, how ? Also is it possible to override the drawing of the "insertion point" ?

Regards

Toby

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jan 2018, 12:05 PM
Hello, Toby,

Thank you for writing.  

RadTreeView handles the whole drag and drop operation by its TreeViewDragDropService. As a descendant of RadDragDropService, TreeViewDragDropService handles the whole drag and drop operation. The PreviewDragOver event allows you to control on what targets the node element being dragged can be dropped on. The PreviewDragDrop event allows you to get a handle on all the aspects of the drag and drop operation, the source (drag) tree view, the destination (target) control, as well as the node being dragged. This is where we will initiate the actual physical move of the node(s) from one tree view to the target control. An alternative approach of handling the mentioned events is to override the relevant methods of the service. A sample implementation is demonstrated in the Modify the DragDropService behavior help article.

I hope this information helps. Should you have further questions I would be glad to help. 
 
 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Treeview
Asked by
Toby
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or