editable grid

Hi 

I have a editable grid where I am showing list of users with edit and delete icon. We don't want inline editing. Hence when person click on edit icon another interface appear where text box, dropdown, and checkboxes needs to pre-filled and selected and checked based on database data. For textbox and dropdown I got the solution but for checkbox I am still struggling. For first time when I click on edit icon right data populate but another time when I click some other record old record data appears. Please help me out in this regards.

= load(
  local!users: a!queryEntity(
    entity: cons!OR_VW_USER,
    query: a!query(
      filter: a!queryFilter(
        field: "role_id",
        operator: "<>",
        value: 1
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1
      )
    )
  ).data,
  ri!actionEvent: "listUsers",
  a!formLayout(
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              rule!OR_addUpdateUser(
                userDetails: ri!userDetails,
                userPropertyInfo: ri!userPropertyInfo,
                userId: ri!userId,
                actionEvent: ri!actionEvent
              )
            },
            showwhen: ri!actionEvent = "saveUser"
          )
        }
      ),
      a!sectionLayout(
        label: "List of Users",
        contents: {
          a!sideBySideLayout(
            items: {
              a!sideBySideItem(
                item: a!textField(
                  labelPosition: "COLLAPSED",
                  placeholder: "Search Users"
                )
              ),
              a!sideBySideItem(
                item: a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Add User",
                      saveInto: {
                        a!save(
                          target: ri!actionEvent,
                          value: "saveUser"
                        )
                      },
                      size: "SMALL",
                      style: "PRIMARY"
                    )
                  },
                  marginBelow: "NONE"
                ),
                width: "MINIMIZE"
              )
            },
            alignVertical: "MIDDLE",
            spacing: "DENSE"
          )
        },
        showwhen: ri!actionEvent = "listUsers",
        marginbelow: "NONE"
      ),
      a!gridLayout(
        totalCount: count(
          local!users
        ),
        headerCells: {
          a!gridLayoutHeaderCell(
            label: "User Name"
          ),
          a!gridLayoutHeaderCell(
            label: "Role"
          ),
          a!gridLayoutHeaderCell(
            label: "Email"
          ),
          a!gridLayoutHeaderCell(
            label: "Status"
          ),
          /* For the "Edit" column */
          a!gridLayoutHeaderCell(
            label: ""
          ),
          /* For the "Re-invite" column */
          /*a!gridLayoutHeaderCell(
            label: ""
          ),*/
          /* For the "Remove" column */
          a!gridLayoutHeaderCell(
            label: ""
          )
        },
        /* Only needed when some columns need to be narrow */
        columnConfigs: {
          a!gridLayoutColumnConfig(
            width: "DISTRIBUTE",
            weight: 2
          ),
          a!gridLayoutColumnConfig(
            width: "DISTRIBUTE",
            weight: 3
          ),
          a!gridLayoutColumnConfig(
            width: "DISTRIBUTE",
            weight: 3
          ),
          a!gridLayoutColumnConfig(
            width: "DISTRIBUTE",
            weight: 3
          ),
          a!gridLayoutColumnConfig(
            width: "ICON"
          ),
         /* a!gridLayoutColumnConfig(
            width: "ICON"
          ),*/
          a!gridLayoutColumnConfig(
            width: "ICON"
          )
        },
        rows: a!forEach(
          items: local!users,
          expression: a!gridRowLayout(
            id: fv!item.user_id,
            contents: {
              /* For the User Name Column*/
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: "User Name",
                value: fv!item.first_name & " " & fv!item.last_name,
                required: true,
                readOnly: true()
              ),
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: "role ",
                value: fv!item.role_name,
                required: true,
                readOnly: true()
              ),
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: "email ",
                value: fv!item.primary_email,
                required: true,
                readOnly: true()
              ),
              a!textField(
                /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */
                label: "status ",
                value: fv!item.user_status,
                required: true,
                readOnly: true()
              ),
              a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: "edit",
                  caption: "Edit",
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      a!save(
                        target:ri!userId,
                        value: fv!item.user_id
                      ),
                      a!save(
                        target: ri!actionEvent,
                        value: "saveUser"
                      )
                    }
                  ),
                  color: "#ffa200"
                ),
                align: "CENTER"
              ),
              /*a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: "reply",
                  caption: "Re-invite",
                  link: a!dynamicLink(),
                  color: "#3eaf63"
                ),
                align: "CENTER"
              ),*/
              a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: "remove",
                  caption: "Delete",
                  link: a!dynamicLink(
                    /*value: fv!index,
                    saveInto: {
                      a!save(local!users, remove(local!users, save!value)),
                      a!save(ri!actionEvent, "deleteUser")
                    }*/
                  ),
                  color: "#dc2d39"
                ),
                align: "CENTER"
              )
            }
          )
        ),
        showwhen: or(ri!actionEvent = "listUsers", ri!actionEvent = "deleteUser"),
        selectable: false,
        addRowlink: {},
        rowHeader: 1
      )
    }
  )
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data