Skip to main content
omj2851
August 23, 2022
Question

a!gridrowlayout in a!foreach

  • August 23, 2022
  • 8 replies
  • 0 views

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

    August 23, 2022

    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
    August 23, 2022

    Thanks for this support...

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

    August 23, 2022

    Where you want to use fv!index and why?