Re-arrange treeview nodes

4 posts, 0 answers
  1. Carlos
    Carlos avatar
    6 posts
    Member since:
    Jan 2011

    Posted 07 Apr 2011 Link to this post

    I know this has been a pertinent question.

    I have achieved almost a full drag-and-drop functionality using a RIA Databound RadTreeView withthe HierarquicalTemplate.

    I'm currently using the DragAndDropManager to process the Preview events to query if the DND operation is possible or not. However, the only thing i am missing, is arranging the order of the nodes.

    My hierarquical data has a SortId field, and i can update the sortId and re-calculate all the SortIds on the item's ViewModels. However, when i update an item's SortID i dont know how do i tell the TreeView to update the nodes index position...

    Is there any way to databind the SortID to the TreeView to achieve the described feature?

    Looking forward for a solution...
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 12 Apr 2011 Link to this post

    Hi Carlos,

    The RadTreeView is just a visual representation of your hierarchical data. On the other hand the Index of the RadTreeViewItem shows the index of the item in its parent ( RadtreeViewitem or RadTreeView)`s Items collection. If you make any changes in the database you have to rebind the treeview in order to apply the changes. If you want your drag and drop reordering operation to reflect in the database, you have to implement your logic ( calculating the new sort Ids ( if you change them) ) and then submitting the changes in the database. Do you actually need the Index of the RadTreeViewItem in this case?
    However, a blog post showing how to synchronize dnd reordering operation with the database is in our to do list and we'll do our best to have it finished for the beginning of May.
    You can check related blog article here and feel free to ask if you need further assiatance or info.

    Greetings,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Carlos
    Carlos avatar
    6 posts
    Member since:
    Jan 2011

    Posted 12 Apr 2011 Link to this post

    Thanks for the response.

    I can assure that the re-sorting is being calculated correctly because if i check the database, the items are sorted accordingly. But when that operation occurs i need a way to tell the treeview to refresh that specific parent.

    I guess that what i am looking for is how to refresh a parent  node.

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 18 Apr 2011 Link to this post

    Hello Carlos,

    Please first excuse us for the delayed response. In order to help you better , could you please send us some code snippets describing the way you perform your drag and drop operations, the DB relationships and the ViewModels. This way we could get into your situation quicker and provide you with a possible approach. Thank you for your cooperation.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top