Skip to content

Passing ui options down to array items #4160

Open
@RAFA3L

Description

@RAFA3L

Prerequisites

What theme are you using?

chakra-ui

What is your question?

Hello, I'm using custom templates to display only plain data and I would like to add a custom uiSchema option to count the total of items in a nested array, for example

  • group1
    • item0
    • item1
  • group2
    • item2 (instead of 0)
    • item3 (instead of 1)

In the ArrayFieldTemplate I'm trying adding an offset index for each group into the uiSchema options, but I think these options apply for all, independently if I set it for each group., for example:

props.items.map((item, index) => {
  if (index > 0) {
    set(item, ['children', 'props', 'uiSchema', 'list', 'items', 'options'], { indexOffset: props.items[index - 1].totalItems });
  }      
  return item;
});

After that all the items have the same latest index, and I would like to pass the totalItems from the previous group to the next one.

Thanks in advanced

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions