Change in child nodes value will appear or affect in root node or parent node

in below snap , there is one root node and two child nodes. i want to make a function whenever child nodes values changes it will appear or affect the root node value… i want to make child nodes values sum is exactly equal to parent node value… mean if 1000 is present in root node then if two childs are there it will distribute the value like 500 each in child node and if i change the value then it will affect or appear in root node or parent.

I assume that your node data objects in the model have a property whose value is what is summed with those of its sibling nodes.

So perhaps you could implement a Changed listener on your Model that looks for that propertyName being changed. Then you could find the parent node and update its value property based on the values of all its children.

An example that is different from what you want: https://gojs.net/latest/samples/tournament.html

i see the example that you mentioned in your reply but it won’t help me enough to achieve my thing what i want to do with the values of node …but somehow i manage to change the values of node …further i have to iterate through all the tree nodes and update all the values…

By the way thanks for your response!!

There are a bunch of properties and methods on the Node class that help you navigate the graph, including ones that specially work on tree-structured graphs.

At each Node you can look at the properties on the Node.data object, which is what is in the Model.nodeDataArray. And you can change those properties by calling Model.set.

Remember to make all changes within one transaction.

yeah i did it! thank you!