jdorn / json-editor

JSON Schema Based Editor
MIT License
5.81k stars 1.08k forks source link

Empty schema and schema with data (startval or setValue) are different #658

Open mbknor opened 8 years ago

mbknor commented 8 years ago

Let say we have a schema with the following properties: a, b, c

If I generate the GUI with only schema and no data, all three properties are correctly shown.

If I generate the GUI using the same schema, but this time also setting data (startval or setValue) and the data only contains values for the properties: a and b, then only those two properties are shown. If I want to edit the property c, I have to enable it in the Properties-list.

I cannot see how this is an intended behavior.

The setValue-implementation of all editors has a second parameter called initial.

This parameter is not set to true when using startval, and it is not possible to set it when using editor.setValue().

I had to use editor.root.setValue(data, true); to fix it.

antoinemeyer commented 7 years ago

thanks a lot for the editor.root.setValue(data, true); tip