You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
not sure if this is a bug in the editor itself or in the component, but when i change some field name, the changes are not reflected in the editor:
it seems like the "required" part is updated
but the field name itself is not. the result is that the field is not considered required anymore
you can replicate with the attached example, click on 'onClick1' and then 'onClick2'. the field 'firstName' is renamed in the schema by the code (see app.vue) to 'firstName2', but you can see that it's not reflected in the editor.
It is kind of buggy when the schema is changed after initialization finished.
I found it is difficult to fix it.
My use case is when a field is like true, field firstName exists, when field is false, fleld firstName2 exists and firstName disappear, I can use the non-standard requiredWhen (https://github.com/plantain-00/schema-based-json-editor#features ; the online demo shows it too) to do this.
<json-editor
v-if="visible"
// USING V-IF TO TOGGLE VISIBILITY OF THE EDITOR, HENCE CREATE/DESTROY
:schema="schema"
:initial-value="value"
theme="bootstrap4"
icon="fontawesome4">
...
data () {
return {
visible: true,
...
onClick: function (event) {
this.schema = JSON.parse(this.editorText)
this.visible = false
setTimeout(() => this.visible = true, 50);
// TOGGLING VISIBILITY WITHOUT A TIMEOUT DIDN'T WORK
}
hi,
thanks for your support !
not sure if this is a bug in the editor itself or in the component, but when i change some field name, the changes are not reflected in the editor:
you can replicate with the attached example, click on 'onClick1' and then 'onClick2'. the field 'firstName' is renamed in the schema by the code (see app.vue) to 'firstName2', but you can see that it's not reflected in the editor.
a workaround is also good at this point...
thanks
sharon
example.zip
The text was updated successfully, but these errors were encountered: