Open tgeorges opened 9 years ago
I just added a new option keep_oneof_values
. It defaults to true
to keep the current behavior, but you can set it to false
to do what you want.
Set globally:
JSONEditor.defaults.options.keep_oneof_values = false;
Set per JSONEditor instance:
var editor = new JSONEditor(el, {
schema: {...},
keep_oneof_values: false
});
Set for a single oneOf instance:
{
"options": {
"keep_oneof_values": false
},
"oneOf": []
}
Hi and thank you Jeremy, I will try it this week.
I've just tried out @tgeorges example with the additional keep_oneof_values
property, and it seems to solve the problem.
@tgeorges example with modification added: link
Therefore I reckon this could be closed off!
Thank you for the fantastic library.
Hi Jeremy !
First of all, thank you for your brilliant work, it's great.
I'm trying to use your editor to provide different type of objects in the same array (the objects are all based on the same base class)
To do this I have defined a schema using oneOf keyword, like that :
It is working at load and for the first change of object type. After that, in memory json seem to be "corrupted".
The object attributes are retained and appears in the UI even if they are not defined in the schema.
With that exemple :
You can try it using that link
I hope you have an idea, Thank you for your help,
Tony