For each loop to display the items side by side

Certified Senior Developer

Hi,

I have a gridfield inside a foreach loop. I need to display the items side by side. Currently it is displayed one below the other. I need to display 2 grids in each row. 

How to achieve this.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to srinivaasant574373


    a!localVariables(
      local!caseGridDatraForAllUsers: enumerate(5),
      local!numberOfColumns: 2,
      {
        a!columnsLayout(
          columns: a!forEach(
            items: enumerate(2) + 1,
            expression: a!localVariables(
              local!colIndex: fv!index,
              a!columnLayout(
                contents: {
                  a!forEach(
                    items: local!caseGridDatraForAllUsers,
                    expression: if(
                      or(
                        mod(fv!index, local!numberOfColumns) = local!colIndex,
                        and(
                          mod(fv!index, local!numberOfColumns) = 0,
                          local!colIndex = local!numberOfColumns
                        )
                      ),
                      {
                        a!cardLayout(contents: { a!richTextDisplayField() }),
                        a!gridField()
                      },
                      {}
                    )
                  )
                }
              )
            )
          )
        )
      }
    )

    Refer "CARDS AS A LIST ITEMS" in patterns of the Interface for better understanding