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 - Finding a Node by key
posted

Before we ask the obvious, I am attempting to use the 'FindNodeByKey(string)' method of the Nodes collection...

 

Back in the day of the UltraWebTree a similar method would search the entire node collection of the tree and return the node it found.  Is there something similar with the WebDataTree, or will I have to recurse through the entire structure.  Here is what I am attempting:

 

  1. I populate the WebDataTree using a table with node_id and parent_node_id (a binary tree structure).
  2. Then, I want to adjust the image of a few of the nodes based on another table.  Therefore, I
    1. Loop through the rows in the second dataset (2, the one that tells me that a node needs a different image)
    2. Perform the Find on the WebDataTree using to node_id field (which is the Nodes key) of the second dataset
    3. And, update the image of the node.

That works better for me than mucking with my reusable code.  The second dataset contains very few records.

Hopefully, this will not force me to recurse through the Nodes on the WebDataTree level by level.  I had code like that for the UltraWebTree, but scrapped it when I found the 'Find' method.

  • 29417
    Verified Answer
    Offline posted

    Hello BOGHRD, 

    Thank you for posting in our forum. 

    The FindNodeByKey method will only return the node on the specific Nodes collection on which you’ve called the method.

    In order to find a specific node based on its key in the complete list of nodes in the tree you can use the AllNodes property which will return an array list with all nodes in the tree in depth-first order. You can loop in that collection and check the related Key of each node.

     Let me know if you have any questions. 

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://es.infragistics.com/support