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

Drag and Drop - Make Children into Roots

1 Answer 63 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 26 Jan 2013, 03:08 AM
Hello,

While working with the TreeList Drag and Drop example, I've noticed that there doesn't appear to be a way to drag child nodes to the top-most level. Given that it is possible to drag root nodes beneath their peers to create child nodes, and since this functionality can be seen in the TreeView Drag and Drop example, I would expect that the control also supports the aforementioned scenario.

So, is there a property or setting that I must set to enable this behavior on the TreeList, or if the implementation is more complex, may I request an example showing how to achieve this?

UPDATE: I've managed to implement this functionality using a custom "ItemDrop" event handler. I'm still interested in identifying a simpler solution though.

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 31 Jan 2013, 11:03 AM
Hi,

The functionality that you are trying to achieve requires a modification in the database. TreeList uses a so-called self-referencing hierarchy technique, this is a structure where you are using single table of flat data but because of the rule which is implied in the data you could display it in hierarchical structure. The rule is simple you have two fields with relations, ID and ParentID for example, one item is set as a child to another parent item based on the values of these two fields. For example if you have four items with ParentID equal to five then these four items will be displayed as child items to another item that has its ID property equal to five.

Keeping this in mind when you want to change the structure of your RadTreeList instance you need to modify the values of these fields in the datasource. So, the approach will not be easy and if your solution do the job you may want to stick to it.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeList
Asked by
Tony
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or