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

Reordering Nodes in binding mode

2 Answers 109 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Dadan
Top achievements
Rank 1
Dadan asked on 07 Dec 2012, 07:54 AM
Hi guys,
beforehand, i use my radtreeview without binding it to another object.
It works very nice, and i also use drag & drop facility, is very userfriendly.
No additional code needed to use this drag & drop.

and then, i use a radtreeview and bind it to datatable. the datatable has hierarchy inside it.
I use parentmember and childmember property and it works very nice.

but, when i try to use drag & drop between nodes, it becomes weird.
e.g : 
i've 5 node, A, B, C, D, E
when i try to move node C after the node A (become the second node), it move to the last node (after E).
the new position not exactly what i want.

i open the Telerik demo application for Winforms, with the chapter Treeview/Self Referencing, and i also find the same condition with my situation.
can anyone explain me about this ?

thx alot for your attention, sorry if my english is not good enouh....

2 Answers, 1 is accepted

Sort by
0
Accepted
Julian Benkov
Telerik team
answered on 12 Dec 2012, 12:58 PM
Hi Dadan,

This the normal behavior of the drag & drop operation in this case. In the self-reference scenario the data is stored in one table and when the drag & drop operation is executed the parent key for the drop node is changed to the new one. The operation does not change the order of the records in the DataTable/database. In order to support this operation, the drag & drop operation must find the position of sibling node in the external source and make remove / insert operations at that position. In addition, it should update the related database to insert the record at this position. This operation can be more complex and can not be supported in many data-binding scenarios. For this reason the drag & drop operation is implemented to support the general case and change only the parent key of the DataBountItem using the relation information settings of RadTreeView.

I hope this information is useful. Let me know if you need further assistance.

All the best,
Julian Benkov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Howard
Top achievements
Rank 1
answered on 18 Dec 2012, 02:12 AM
Thanks for the answer!
Tags
Treeview
Asked by
Dadan
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Howard
Top achievements
Rank 1
Share this question
or