Hi,
I’m trying to implement custom handling of rules for fields inside arrays of objects.
schema:
{
"type":"object",
"properties":{
"textInput":{
"type":"string"
},
"itemsArray":{
"type":"array",
"items":{
"type":"object",
"properties":{
"fieldToHide":{
"type":"string"
}
}
}
}
}
}
uischema:
{
"type":"VerticalLayout",
"elements":[
{
"type":"Control",
"scope":"#/properties/textInput",
"label":"Text Input"
},
{
"type":"Array",
"scope":"#/properties/itemsArray",
"options":{
"detail":{
"type":"VerticalLayout",
"elements":[
{
"type":"Control",
"scope":"#/properties/fieldToHide",
"label":"Field to Hide"
}
],
"rule":{
"effect":"HIDE",
"condition":{
"scope":"#/properties/textInput",
"schema":{
"const":"123"
}
}
}
}
}
}
]
}
In the array renderer, I’d like to resolve the rule for each field and pass the result to the visible prop of JsonFormsDispatch. The issue is that even if I hardcode visible={false}, at some point this value gets overridden and reset to true.
Does anyone know how to approach this so that visible doesn’t get overwritten? My goal is to use this to dynamically hide/show fields within object arrays.