Drag and Drop - Make Children into Roots

2 posts, 0 answers
  1. Tony
    Tony avatar
    3 posts
    Member since:
    Jan 2013

    Posted 25 Jan 2013 Link to this post


    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.
  2. Andrey
    Andrey avatar
    836 posts

    Posted 31 Jan 2013 Link to this post


    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.

    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.
Back to Top