Skip to content

Condition for nested array? #962

Closed
Closed
@person2713

Description

@person2713

I have some example:

`
{
  "schema": {
  "type": "object",
  "properties": {
	"name": {
		"type": "string"
	},
	"Objects": {
		"type": "array",
		"items": {
			"type": "object",
			"properties": {
				"object": {
					"type": "object",
					"properties": {
						"objectId": {
							"type": "string"
						},
						"objectName": {
							"type": "string"
						},
						"attributes": {
							"type": "array",
							"items": {
								"type": "object",
								"properties": {
									"attributeId": {
										"type": "string"
									},
									"attributeName": {
										"type": "string"
									},
									"value": {
										"type": "string"
									}
								}
							}
						}
					}
				}
			}
		}
	}
  }
},
  "form": [
      {
        key: 'name'
      },
      {
        key: 'Objects',
        type: 'array',
        items: [
          {
            key: 'Objects[].object',
            items: [
              {
                key: 'Objects[].object.objectId'
              },
              {
                key: 'Objects[].object.objectName',
                condition: 'model.Objects[arrayIndex].object.objectId',
                readonly: 'true'
              },
              {
                key: 'Objects[].object.attributes',
                type: 'array',
                items: [
                  {
                    key: 'Objects[].object.attributes[].attributeId'
                  },
                  {
                    key: 'Objects[].object.attributes[].attributeName',
                    condition: 'model.Objects[arrayIndices[0]].object.attributes[arrayIndices[1]].attributeId',
                    readonly: 'true'
                  },
                  {
                    key: 'Objects[].object.attributes[].value'
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        type: 'section',
        htmlClass: 'row',
        items: [
          {
            type: 'section',
            htmlClass: 'col-md-1',
            items: [
              {
                type: 'submit',
                title: 'Add'
              }
            ]
          }
        ]
      }
    ]
}
`

on https://angular2-json-schema-form.firebaseapp.com/?set=asf&example=asf-array&framework=bootstrap-4&language=en.
There are any idea?
P. S. I read #742 but it does't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions