Dynamic grid .

A Score Level 1

Hi , 

I have a requirement in which the user enters any numerical value , lets say 2 , so a grid should be created with two rows.
Likewise, he can enter n values , so n rows should be created . The entries filled into these rows(grid) are to be saved into a table after submit.

please let me know the implementation.

  Discussion posts and replies are publicly visible

Parents
  • load(
      local!rowsCount,
      local!items: {},
      a!sectionLayout(
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!integerField(
                    label: "Enter No Of Rows",
                    value: local!rowsCount,
                    saveInto: {
                      local!rowsCount,
                      a!save(
                        local!items,
                        if(
                          isnull(
                            local!rowsCount
                          ),
                          {},
                          a!forEach(
                            items: repeat(
                              local!rowsCount,
                              1
                            ),
                            expression: {
                              firstName: "",
                              lastName: ""
                            }
                          )
                        )
                      )
                    }
                  )
                }
              ),
              a!columnLayout(
                contents: {}
              )
            }
          ),
          a!gridLayout(
            label: "Dynamic Grid",
            headerCells: {
              a!gridLayoutHeaderCell(
                label: "First Name"
              ),
              a!gridLayoutHeaderCell(
                label: "Last Name"
              ),
              
            },
            rows: {
              a!forEach(
                items: local!items,
                expression: a!gridRowLayout(
                  contents: {
                    a!textField(
                      value: local!items[fv!index].firstName,
                      saveInto: local!items[fv!index].firstName
                    ),
                    a!textField(
                      value: local!items[fv!index].lastName,
                      saveInto: local!items[fv!index].lastName
                    )
                  }
                )
              )
            },
            rowHeader: 1,
            showWhen: if(
              isnull(
                local!rowsCount
              ),
              false(),
              true()
            )
          )
        }
      )
    )

  • hey , thanks , this is exactly what i needed. 

Reply Children
No Data