I have two webdatatrees that I am using to represent a file system structure of folders and documents that I am using for file move. Basically, customers who need to move files would select them from the first tree and drop them on the second tree (similar to the Multi Tree sample - including image below). Both trees represent the same file system so they are identical but I only allow drag from the first tree and only allow nodes to be dropped on the second tree. The webdatatrees remove the selected node and add to the second tree a-ok, but here is the problem: I need the new folder/file positions reflected in the first tree (currently just removes it) and the old folder/file positions to be removed from the second.
For example: I drug the Whitesnake folder from the first tree and dropped it in the Y.Malmsteen folder (circled in red) on the right. The original position of the Whitesnake folder is circled in blue in the second tree -- I would prefer that disappear as well in the second tree and display in the correct folder in the first tree (marked with ??? in blue). Is there an easy way to do this client side?
Hi Labbrown,
Please let me know if you are still experiencing any issues.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.https://ko.infragistics.com/support
I now understand what you are looking for. This is a more complex task, requiring a recursive search of the tree nodes and removal of the node at the old position (which means the "new" and "old" node have to be distinguished).
The following thread provides an example of searching a WebDataTree recursively:
https://ko.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/53809/how-to-hide-a-node-in-the-tree-at-any-level/278297#278297
I am continuing my research on the subject and will keep you posted with any updates.
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.https://ko.infragistics.com/support
Thanks for the reply, Peter. I think I may not have been clear with what the actual problem was. When I drag nodes from say tree_A to tree_B, the moved nodes in tree_A do disappear. So that is not a problem. The issue is that both trees are only half correct -- tree_A shows that the folder was moved, but doesn't show where the folder was moved to (because I dropped it on tree_b). Tree_B shows where the folder was moved to, but also shows the original position of the folder (it wouldn't have been deleted because I dragged the nodes from tree_a, not tree_b). Dropping the nodes and copying them over from one tree to another is interesting approach, but both trees are still only half correct (either displaying the updated position of the folder or having removed the old location - not both).
I'm going to try to manually add/remove the nodes server side during the nodeDropped event instead of trying to do this client-side and see if I have any luck with that.
Hi Labrown,
There does not seem to be a straightforward approach to synchronize multiple WebDataTrees on the client.
As far as nodes not disapearing from their original position, this may be due to the DragDropMode of the trees being set to "Copy".
I have created a sample for you which demonstrates how multiple trees can be synchronized server-side. The sample uses a simple xml data source. Reflecting the node changes between the trees effectively takes place in the NodeDropped event handlers of the trees.
Hope this helps. Please contact me if you have any questions.