Janekk
(Janusz Kacalak)
June 30, 2022, 1:31pm
#1
Hi,
My schema contains a field that is an array of objects and I want to make these objects readonly. I tried setting the readOnly
flag on a few levels but the sub-forms for array items still render as editable. How could I make them readonly?
Here is a branch on a fork of jsonforms-react-seed
: Comparing eclipsesource:master...Janekk:readonly-array-items · eclipsesource/jsonforms-react-seed · GitHub
Notice readOnly
flags I added on the schema
Janekk
(Janusz Kacalak)
June 30, 2022, 1:37pm
#2
setting readOnly on individual properties worked:
"payment": {
"type": "object",
"readOnly": true,
"properties": {
"paid": { "type": "boolean" },
"charges": {
"type": "array",
"readOnly": true,
"items": {
"readOnly": true,
"properties": {
"amount": { "readOnly": true, "type": "number" },
"dispute": { "readOnly": true, "type": [ "boolean", "null" ] }
}
}
}
}
}
but one would expect it would work when we set it the parent object, like it is for payment
sdirix
(Stefan Dirix)
July 3, 2022, 9:14pm
#3
Hi @Janekk ,
Thanks for the report. This looks like a bug and should be fixed. Please open an issue against JSON Forms.
Janekk
(Janusz Kacalak)
July 5, 2022, 10:43am
#4
1 Like