Displayif inside Array #1200
-
How to added the DisplayIf inside an array I have a function like this
And create it inside an array component
It failed to display anything When I checked the context, I need to added the index after the field name, so it should be look like this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @uenokazuma. You can access the <ListField>
<ListItemField name="$">
<AutoField name="field1" />
<DisplayIf condition={({ model, name }) => model.fieldA[name[name.length - 1]]}>
<TextField name="field2" />
</DisplayIf>
</section>
</DisplayIf>
</ListItemField>
</ListField> |
Beta Was this translation helpful? Give feedback.
Hey @uenokazuma. You can access the
context.name
to know "where" in the tree (i.e., in which list element) is the condition evaluated. Here's an example: