Skip to main content
omj2851
Known Participant
Aug 23, 2022 4:22 AM UTC
Question

a!gridrowlayout in a!foreach

I am trying to loop the multiple gridrowlayout of a editiable grid  using a!foreach but not able to do it.

can i have some directions with possible code.

I required to flash multiple rows with loop on count of queries declared in the interface by the user

    8 replies

    Inspiring
    Aug 23, 2022 5:24 AM UTC

    Please refer the below code.

    a!localVariables(
      local!count,
      local!tech,
      local!gridData: if(
        a!isNullOrEmpty(local!count),
        null,
        a!forEach(
          items: enumerate(local!count) + 1,
          expression: { ques: "", option: "" }
        )
      ),
      {
        a!textField(
          label: "Tech",
          value: local!tech,
          saveInto: local!tech
        ),
        a!textField(
          label: "Count",
          value: local!count,
          saveInto: local!count
        ),
        a!gridLayout(
          headerCells: {
            a!gridLayoutHeaderCell(label: "Question"),
            a!gridLayoutHeaderCell(label: "Options")
          },
          rows: a!forEach(
            items: local!gridData,
            expression: a!gridRowLayout(
              contents: {
                a!textField(
                  value: fv!item.ques,
                  saveInto: fv!item.ques
                ),
                a!textField(
                  value: fv!item.option,
                  saveInto: fv!item.option
                )
              }
            )
          )
        )
      }
    )

    omj2851
    omj2851Author
    Known Participant
    Aug 23, 2022 6:07 AM UTC

    Thanks for this support...

    but now how can we use fv!index on this for each iteration..

    Om Joshi
    Inspiring
    Aug 23, 2022 6:08 AM UTC

    Where you want to use fv!index and why?