I have two WebDataTrees on a single page. I use one as a "Toolbox" to perform tasks on the 2nd tree. These tasks include adding, removing and editing nodes. I want to be able to drag a "New Node" from the toolbox tree to the 2nd tree and upon completion of the drop, immediately put that new node into edit mode. I've tried to handle the client side event in NodeDropped and NodeAdded but neither seems to get me where I need to go. This is the code I have been playing with in the NodeAdded handler.
function onClientNodeAdded(sender, args) {
var tree = $find('<%= trvGeographic.ClientID %>'); var addedNode = args.getNode();
//Make sure the tree view and added node were found if ((tree != null) && (addedNode != null)) { var instanceVar = tree.getNodeEditing(); var resultVar = instanceVar.enterNodeEditing(addedNode); }}
It appears as though at this stage the added node is of type igdt_NodeHolderDragDrop and therefore does not have the same methods/properties available for use in order to set it into edit mode. NodeDropped fires after NodeAdded but it doesn't seem to be any better at handling what I want to do. NodeDropped does not even allow me to get a reference to the Dropped node using args.getNode(). That throws a javascript error and destination and source nodes are useless to me as they're not the nodes I'm trying to throw into edit mode. Is it possible to do what I'm attempting?
Also, I want my toolbox to have Editable set to "No". The problem is this transfers to the new node in the 2nd tree. Can I override the Editable property in client side script? I can see it is readable but not writeabl
Hello nhutchinson,
Thank you for the update.
I am glad you are able to move forward with your application.
If you have any questions, please let us know as well.
I found a workaround before you sent the last response. I cancelled the drop, added a new node manually and then sent that node into edit mode. Code is below. Thanks
//We'll do the add node manually. Cancel the eventargs.set_cancel(true);
var node = sender.createNode("New Location");sender.add(node, destinationNode._address.toString());destinationNode.set_expanded(true);
//Reset the node in order to get a valid reference to it rather than the ig_dropPlaceholder objectnode = destinationNode.get_childNode((destinationNode.get_childrenCount() - 1));
var instanceVar = tree.getNodeEditing();var resultVar = instanceVar.enterNodeEditing(node);
Please let me know if you have any questions.
My apologies. I was not able to update sooner.
By handling NodeDropped event, the currently dropped node is the eventArg's previousVisibleNode based off of the destination node, destNode.
On this note, the currently dropped node may be access using the following code:
eventArgs.get_destNode().get_previousVisibleNode()
I hope this helps.
Please let me know how this works out or if you have any questions.
Has there been any work on this issue?