Using setDataProperty with hierarchical model data

If i have model data on a node such as

  key: 'myUID',
  text: 'my text for label',
  serverObject0: {id: 5, prop0: 'A'},
  serverObject1: {id: 20, prop1: 'B'}

Is it possible to use something like

  model.setDataProperty(, 'serverObject0.prop0', newPropertyValue);

to set a new property value on one of the child objects?

More generally, can I set a property that is hierarchical? Or do all properties have to be flattened in the model? If they do need to be flattened, what is the best practice to handle multiple objects that correspond to a single node?

Yes, we intentionally delayed such functionality because it wasn’t clear that it was needed for version 1.0 and it is a bit complex to implement.

But it actually isn’t too difficult to implement yourself. Take a look at this sample:

It defines two functions, makeSubBinding and makeTwoWaySubBinding that assume the data property is on an object that is the value of data.details. You seem to have at least two such properties that have sub-objects as values, so you might be able to generalize those two functions to parameterize the “details” property name.

I hope the code make sense to you. Tell me if you encounter any difficulties.

it performs exactly the way I want it, I’ll have to study a bit and then get back to you.