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

Re-arrange treeview nodes

3 Answers 62 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 07 Apr 2011, 10:08 AM
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...

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 12 Apr 2011, 12:58 PM
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
0
Carlos
Top achievements
Rank 1
answered on 12 Apr 2011, 02:41 PM
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.

0
Petar Mladenov
Telerik team
answered on 18 Apr 2011, 07:50 AM
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
Tags
TreeView
Asked by
Carlos
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Carlos
Top achievements
Rank 1
Share this question
or