Making forms of array items readonly

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

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 :thinking:

Hi @Janekk,

Thanks for the report. This looks like a bug and should be fixed. Please open an issue against JSON Forms.

ok, thank you, issue added here Making forms of array items readonly · Issue #1969 · eclipsesource/jsonforms · GitHub

1 Like