I wanted to create a renderer/control that would be able to add, remove and update properties of an object.
Let’s say the JSON Schema is something very permissive like
{
“type”: “object”,
“minProperties”: 1
}
I wanted to take advantage of DispatchPropsOfControl.handleChange(), it seems like I can add a property but I didn’t find a way to remove it. Setting the value to undefined didn’t help.
Hi @JBBianchi, you can definitely unset values via handleChange, i.e. handleChange(your-path, undefined) should work. Can you give some more context where this doesn’t work for you? How does the data object look like before and after and which path are you handing over to handleChange?
Hello @sdirix , thanks for you reply. I think my problem lies more at the level of props.data in mapAdditionalProps rather than the “global” data.
Here is an example of the use case github[DOT]com/JBBianchi/jsonforms-angular-seed/blob/master/src/app/edit-object.renderer.ts#L105
For instance, the data looks like this {"examples": {"object": {"hello": "world"}}}
If I call handleChange('examples.object.hello', undefined);, the global data looks like this {"examples": {"object": {}}} (so that’s good)
But in mapAdditionalProps(props), I have props.data as {"hello": undefined} where I expected {}.