SchemaResolver with array of objects of dynamic
I had an array of objects A and each of object contains filter. Each filter options will display different kinds of forms objects dynamically.
Based on the issue https://github.com/brutusin/json-forms/issues/22, the dynamic done in the first layer of the object. But I have array of objects A that doesn't work for each display.
var schema = {
"properties": {
"ObjectA": {
"type": "array",
"items": {
"type": "object",
"properties": { "filter": ...., "criteria": { "dependOn": ['filter'] } }
}
}
}
}
var dynamicSchema = {
"age": { type: "Object", number: 21 },
"country": { type: "Object", name: "US" }
}
var BrutusinForms = brutusin["json-forms"];
this.bf = BrutusinForms.create(schema);
this.bf.schemaResolver = (names, data, cb) => {
data.ObjectA.map((obj, ind) => {
schemas["$.ObjectA[" + ind + "].criteria"] = dynamicSchema[obj.filter]
}
cb(schemas);
}
this.bf.render(this.$refs.manageContainer);
The name always outputs schemas["$.demographic[#].criteria"] no matter which filter I add.
If I add schemas["$.demographic"], it works for me without the filter but the dynamic schema objects.
https://github.com/brutusin/json-forms/blob/master/README.md#status
hello, did you solve this problem? I also meet this problem, thanks!