Now I would like to create a Binding (e.g. for displaying some text) for the Node with id 2 which should update whenever the “value” property of node with id 1 changes.
What would be the best way to do so?
I couldn’t find an option using a binding, as the binding cannot(?) be bound to data of other nodes.
I could subscribe to the onModelChanged event and then manually call updateTargetBindings(), but in this case, how do I get the id of the node which triggered the event?
That is correct – Bindings only work within a single Part, or within a single Panel created for an itemArray item.
I suggest that you use other means to detect changes and update accordingly. What you suggest, using a Model Changed listener, is a reasonable choice. The Tournament sample demonstrates exactly what you are talking about: Tournament
Unfortunately I don’t have the complete node.data in the object property, as I am only updating a specific property of the node.data using setDataProperty. And I couldn’t find any other property in the onModelChanged event which tells my which node was changed.
However then I realized that if I use setDataProperty(), I don’t need to put my updateTargetBindings() logic into the onModelChanged listener but instead can call it directly after setDataProperty(), because at this point I know which node was changed :-)