Skip to main content
November 14, 2022
Question

how to add multiple rows on one click of add row link in editable grid?

  • November 14, 2022
  • 3 replies
  • 0 views

In the editable grid I want to add 2 rows on click of add row link, please help me out how to add dt ?

    3 replies

    mikes0011
    Brainy
    November 14, 2022

    This should be about as easy as utilizing the standard "add row link" and having it add 2 new entries to the dictionary storing your row data.  Without more detail it's hard to say exactly what you'll need.  What have you tried so far and had difficulty with?

    Quick example:

    a!localVariables(
      local!rows: {
        {
          name: "row 1",
          id: 1
        }
      },
      
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "name")
        },
        rows: a!forEach(
          local!rows,
          a!gridRowLayout(
            contents: {
              a!richTextDisplayField(
                value: fv!item.name
              )
            }
          )
        ),
        addRowLink: a!dynamicLink(
          label: "Add Row(s)",
          saveInto: {
            a!save(
              local!rows,
              append(
                local!rows,
                {
                  {
                    id: max(local!rows.id) + 1,
                    name: "row " & max(local!rows.id) + 1
                  },
                  {
                    id: max(local!rows.id) + 2,
                    name: "row " & max(local!rows.id) + 2
                  }
                }
              )
            )
          }
        )
      )
    )

    The Expression Guru
    November 14, 2022

    I want to populate 2 rows.
    for 1 primary key, there are 2 language id's so in grid I have 2 columns one to add name, another to add description .
    So if I click add row link I want 2 rows to enter values for both language id's.

    I have tried forEach() for add row link but its not accepting list 

    mikes0011
    Brainy
    November 14, 2022

    Please post a code sample and relevant screenshots.

    The Expression Guru