Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1414
WebDataTree - How to fully populate new Node after CSOM creation with tree.add(node, location);
posted

To All,

 

I have a requirement to create new, fully populated, nodes as leafs in a populated WebDataTree.  Right now, I create a new node in CSOM JavaScript with:

 

var tree = $find("<%= wt.ClientID %>");

var node = tree.createNode('New Folder');

var parent = tree.get_selectedNodes();

location = $adrutil.getLocationFromDomElement(parent[0].get_element());

 

And, add it to the selected node (which will be the Parent Node)) with the WebDataTree add method

 

tree.add(node, location);

 

The add method then triggers the NodeAdded server side event.

 

My problem is that the client side Node object does not seem to have a Key property and the ParentNode property is not populated.  I need to be able to create database records supporting the WebDataTree and use the generated Unique GUIDs for the new node's Key property.  I thought I could set these in the NodeAdded server side event, but the e.Nodes[0] object passed is not added to the WebDataTree and seems completely detached.  Executing a Nodes.Add method passing e.Nodes[0] causes another NodeAdded event to be fired.

I guess my main questing is how can I use CSOM to either build a fully developed node and add it to the selected parent node (thus, I can grab the properties and create the new database record) or trigger the server side NodeAdded method to add the fully developed node.  Right now, a CSOM node is generated without a Key property and not database attached and a well formed node is created and added to the tree server side.  I have duplicates.

 

Parents Reply Children
No Data