Issue with Selection in the read-only grid

Certified Associate Developer

Hi,

I have Selectable Read-only grid and when I select few rows and click on select button a review grid will appear on the next page with the selected rows. Now I have an EDIT button which takes me to the previous page to select/de-select the rows, then here comes the issue that all the previous selection of the rows are getting removed.

The EDIT button doesn't have anything to remove the selection.

I'm not able to figure out what the issue is.. Can someone please help.

This is my code for the selectable grid and review grid. 

a!localVariables(
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: cons!RGRACSLBL_BATCHSIZE_5
  ),
  local!selectedBDLMAgreementActivities: if(
    not(
      or(
        rule!APN_isBlank(ri!BWELSelectedIds),
        rule!APN_isEmpty(ri!BWELSelectedIds)
      )
    ),
    index(
      ri!veevaResults.data,
      wherecontains(
        touniformstring(ri!BWELSelectedIds),
        touniformstring(index(ri!veevaResults.data, "id", {}))
      ),
      {}
    ),
    {}
  ),
  local!selectedRowDetails,
  local!selectedRow,
  {
    a!sectionLayout(
      label: if(
        ri!readOnly,
        "Review BDLM Multi Agreement Activity",
        "Select BDLM Multi Agreement Activity"
      ),
      contents: {
        a!localVariables(
          local!selectedActivities: todatasubset(
            local!selectedBDLMAgreementActivities,
            local!pagingInfo
          ),
          {
            if(
              ri!readOnly,
              {
                a!gridField(
                  label: "",
                  data: local!selectedActivities,
                  columns: {
                    a!gridColumn(
                      label: "Multi Agreement Activity Name",
                      value: a!richTextDisplayField(
                        value: a!richTextItem(
                          text: index(fv!row, "name__v", {}),
                          link: a!forEach(
                            items: fv!row,
                            expression: a!safeLink(
                              label: index(fv!item, "name__v", {}),
                              uri: rule!RGRACSLBL_createBDLMAgreementUrlId(
                                baseURL: index(
                                  cons!RGRACSLBL_VEEVA_BASE_URL,
                                  cons!RGRACSLBL_ENVIRONMENT_CURRENT
                                ),
                                agreementId: index(fv!item, "id", {})
                              )
                            )
                          )
                        )
                      )
                    ),
                    a!gridColumn(
                      label: "Product Name",
                      value: index(fv!row, "product__crname__v", {})
                    ),
                    a!gridColumn(
                      label: "Activity Type",
                      value: index(fv!row, "object_type__name__v", {}),
                      align: "START"
                    ),
                    a!gridColumn(
                      label: "Created By",
                      value: index(fv!row, "created_by__v", {})
                    ),
                    a!gridColumn(
                      label: "Created Date",
                      value: a!forEach(
                        items: rule!RGRACSLBL_merckDateFormat,
                        expression: todate(index(fv!row, "created_date__v", {}))
                      )
                    )
                  },
                  
                  pagingSaveInto: local!pagingInfo
                  
                  
                )
              },
              a!localVariables(
                local!veevaResults: cast(
                  a!listType(
                    typeof(
                      'type!{urn:com:appian:RGRACSLBL}RGRACSLBL_BDLMProductAgreements'()
                    )
                  ),
                  ri!veevaResults.data
                ),
                a!gridField(
                  label: "",
                  data: local!veevaResults,
                  columns: {
                    a!gridColumn(
                      label: "Multi Agreement Activity Name",
                      value: a!richTextDisplayField(
                        value: a!richTextItem(
                          text: index(fv!row, "name__v", {}),
                          link: a!forEach(
                            items: fv!row,
                            expression: a!safeLink(
                              label: index(fv!item, "name__v", {}),
                              uri: rule!RGRACSLBL_createBDLMAgreementUrlId(
                                baseURL: index(
                                  cons!RGRACSLBL_VEEVA_BASE_URL,
                                  cons!RGRACSLBL_ENVIRONMENT_CURRENT
                                ),
                                agreementId: index(fv!item, "id", {})
                              )
                            )
                          )
                        )
                      )
                    ),
                    a!gridColumn(
                      label: "Product Name",
                      value: index(fv!row, "product__crname__v", {})
                    ),
                    a!gridColumn(
                      label: "Activity Type",
                      value: index(fv!row, "object_type__name__v", {}),
                      align: "START"
                    ),
                    a!gridColumn(
                      label: "Created By",
                      value: index(fv!row, "created_by__v", {})
                    ),
                    a!gridColumn(
                      label: "Created Date",
                      value: a!forEach(
                        items: rule!RGRACSLBL_merckDateFormat,
                        expression: todate(index(fv!row, "created_date__v", {}))
                      )
                    )
                  },
                  pageSize: 5,
                  
                  selectionValue: local!selectedRow,
                  selectionSaveInto: {
                    local!selectedRow,
                    a!save(
                      local!selectedRowDetails,
                      append(local!selectedRowDetails, fv!selectedRows)
                    ),
                    a!save(
                      local!selectedRowDetails,
                      remove(
                        local!selectedRowDetails,
                        wherecontains(fv!deselectedRows, local!selectedRowDetails)
                      )
                    ),
                    a!save(
                      ri!BDLMAgreementActivity,
                      todatasubset(local!selectedRowDetails,local!pagingInfo)
                    )
                  },
                  
                  
                  
                  selectable: true,
                  shadeAlternateRows: true
                )
              )
            ),
            
          }
        )
      },
      showWhen: ri!search
    )
  }
)

This is my code for the EDIT button.

a!buttonWidget(
                    label: cons!RGRACSLBL_UA_EDIT,
                    value: cons!RGRACSLBL_UA_BACK,
                    saveInto: {
                      local!userAction,
                      a!save(ri!userAction, save!value),
                      a!save(local!saveDraftClicked, false),
                      a!save(local!skipSave, false),
                      a!save(ri!loggedInUser, local!loggedInUser),
                      a!save(ri!showEditButtonFlag, false),
                      a!save(local!showEditButtonFlag, false)
                    },
                    showWhen: local!showEditButtonFlag
                  ),

The grid is a child interface and it is being called in the parent interface as below

rule!RGRACSLBL_SC_BDLMAgreementsList(
                  readOnly: if(
                    or(
                      local!userAction = "review",
                      local!userAction = cons!RGRACSLBL_UA_SAVE_DRAFT
                    ),
                    true,
                    false
                  ),
                  BDLMAgreementActivity: local!BDLMSelectedAgreements,
                  search: local!search,
                  veevaResults: local!results,
                  BWELSelectedIds: local!BWELselectedIds,
                  
                )

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data