brutusin / brutusin/json-forms

Adding new item to an array doesnt show default values when Initial Data is passed

Open
#103 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
618
Forks
171
PR merge metrics
No merged PRs in 30d

Description

This issue is different from Issues #63 and #84

When initial data is passed, the form with array items gets loaded properly as per the initial data passed. However, when a new item is added through **Add item** button, the form elements are not loaded with default data provided in the schema.

This error can be simulated using following schema:

{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "object",
"properties": {
"sorts": {
"type": "array",
"title": "Sorting",
"items": {
"type": "object",
"properties": {
"fieldName": {
"type": "string",
"title": "Field name"
},
"ascending": {
"type": "boolean",
"title": "Ascending",
"default": true
}
}
}
}
}
}

Initial data used:

{
"sorts": [
{
"fieldName": "test",
"ascending": true
}
]
}

![Please click here for generated output on Demo:](https://user-images.githubusercontent.com/1784880/30542987-fefe5c90-9c9e-11e7-8317-e1ef0257cbe0.jpg)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.