Editable grid

Hi, After adding For Each function to rows in my editable grid, the rows not showing in UI. How to make my rows visible?.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Without any code snippet or screenshot, any tip would be just guesswork. Mode details please.

    Did you follow any of the interface patterns like this one: https://docs.appian.com/suite/help/22.3/recipe-add-edit-and-remove-data-in-an-inline-editable-grid.html

  • a!localVariables(
      local!newGridRow: 'type!{urn:com:appian:types:AIP}AIP_items'(),
      a!formLayout(
        label: "Purchase Request",
        contents: {
          a!sectionLayout(
            contents: {
              a!gridLayout(
                label: "Items",
                labelPosition: "ABOVE",
                headerCells: {
                  a!gridLayoutHeaderCell(label: "Description"),
                  a!gridLayoutHeaderCell(label: "Category"),
                  a!gridLayoutHeaderCell(label: "Quantity"),
                  a!gridLayoutHeaderCell(label: "Unit Price"),
                  a!gridLayoutHeaderCell(label: "Amount"),
                  a!gridLayoutHeaderCell(label: "")
                },
                columnConfigs: {
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "ICON")
                },
                rows: {
                  a!forEach(
                    items: ri!items,
                    expression: a!gridRowLayout(
                      contents: {
                        a!textField(
                          label: "Description",
                          labelPosition: "ABOVE",
                          value: fv!item.description,
                          saveInto: fv!item.description,
                          refreshAfter: "UNFOCUS",
                          required: true,
                          validations: {}
                        ),
                        a!dropdownField(
                          label: "Category",
                          labelPosition: "ABOVE",
                          placeholder: "--- Select a Value ---",
                          choiceLabels: cons!AIP_PURCHASE_REQUEST_CATEGORIES,
                          choiceValues: cons!AIP_PURCHASE_REQUEST_CATEGORIES,
                          value: fv!item.category,
                          saveInto: fv!item.category,
                          searchDisplay: "AUTO",
                          required: true,
                          validations: {}
                        ),
                        a!integerField(
                          label: "Quantity",
                          labelPosition: "ABOVE",
                          value: fv!item.quantity,
                          saveInto: fv!item.quantity,
                          refreshAfter: "UNFOCUS",
                          required: true,
                          validations: {}
                        ),
                        a!floatingPointField(
                          label: "Unit Price",
                          labelPosition: "ABOVE",
                          value: fv!item.unitPrice,
                          saveInto: fv!item.unitPrice,
                          refreshAfter: "UNFOCUS",
                          required: true,
                          validations: {}
                        ),
                        a!textField(
                          label: "Amount",
                          labelPosition: "ABOVE",
                          value: if(
                            or(
                              isnull(fv!item.quantity),
                              isnull(fv!item.unitPrice)
                            ),
                            0,
                            tointeger(fv!item.quantity) * todecimal(fv!item.unitPrice)
                          ),
                          saveInto: fv!item.amount,
                          refreshAfter: "UNFOCUS",
                          required: true,
                          validations: {}
                        ),
                        a!richTextDisplayField(
                          labelPosition: "ABOVE",
                          value: {
                            a!richTextIcon(
                              icon: "times",
                              link: a!dynamicLink(
                                label: "Dynamic Link",
                                saveInto: {
                                  a!save(ri!items, remove(ri!items, fv!index))
                                }
                              ),
                              color: "NEGATIVE"
                            )
                          }
                        )
                      },
                      selectionDisabled: false
                    )
                  )
                },
                selectionSaveInto: {},
                addRowLink: a!dynamicLink(
                  label: "Add New Item",
                  saveInto: {
                    a!save(
                      ri!items,
                      append(ri!items, local!newGridRow)
                    )
                  }
                ),
                validations: {},
                shadeAlternateRows: true
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true,
              style: "PRIMARY"
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: ri!cancel,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      )
    )

  • My Ui will showing like this, but when i removed the a! foreach function it displays the rows.

  • 0
    Certified Lead Developer
    in reply to Raviteja

    Hi ravi, your loop is using the rule input have you passed any data in it make sure you have the rule input as an array.

Reply Children
No Data