add row

whenever i click on add it's creating blank row in in RI, but no in the interface 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Can you share your code here are you using for loop to display rows?

    check line number 15

    a!localVariables(
      local!items: {
        { item: "Item 1", qty: 1, unitPrice: 10 },
        { item: "Item 2", qty: 2, unitPrice: 20 }
      },
      a!gridLayout(
        label: "Products",
        instructions: "Update the item name, quantity, or unit price.",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        rows: a!forEach( /* loop to show all rows*/
          items: local!items,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value: fv!item.item,
                saveInto: fv!item.item
              ),
              a!integerField(value: fv!item.qty, saveInto: fv!item.qty),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice
              ),
              a!textField(
                value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        ),
        rowHeader: 1,
        addRowLink: a!dynamicLink(
          label: "Add row",
          saveInto: a!save(
            local!items,
            append(
              local!items,
              { item: null, qty: null, unitPrice: null }
            )
          )
        )
      )
    )a!localVariables(
      local!items: {
        { item: "Item 1", qty: 1, unitPrice: 10 },
        { item: "Item 2", qty: 2, unitPrice: 20 }
      },
      a!gridLayout(
        label: "Products",
        instructions: "Update the item name, quantity, or unit price.",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        rows: a!forEach( /* loop to show all rows*/
          items: local!items,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value: fv!item.item,
                saveInto: fv!item.item
              ),
              a!integerField(value: fv!item.qty, saveInto: fv!item.qty),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice
              ),
              a!textField(
                value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        ),
        rowHeader: 1,
        addRowLink: a!dynamicLink(
          label: "Add row",
          saveInto: a!save(
            local!items,
            append(
              local!items,
              { item: null, qty: null, unitPrice: null }
            )
          )
        )
      )
    )

  • see i have written the same code

    but still it is not creating the row instead their are 13 rows it has created 13 rows by default

Reply Children