Skip to content

Condition for nested array work? #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
person2713 opened this issue Mar 21, 2018 · 0 comments
Open

Condition for nested array work? #242

person2713 opened this issue Mar 21, 2018 · 0 comments

Comments

@person2713
Copy link

person2713 commented Mar 21, 2018

I read json-schema-form/angular-schema-form#742 and try use in angular2-schema-form. But it does't work.
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'
              }
            ]
          }
        ]
      }
    ]
}
`

There are any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant