How to download only selected rows from grid to Excel?

Certified Associate Developer

I see that there is a excel download button in read-only grid.

And can use filter to download what I want.

To go one more step from that and want to download only the selected rows to excel.

How could I do it? 

Would be great to have example too!!

Thank you

  Discussion posts and replies are publicly visible

  • Since the download to excel button takes filters into account, the quickest solution would be adding a button above or below the grid which only displays selected rows. 

    a!localVariables(
      local!selectedRows: {},
      local!filterSelectedRows: false,
      {
        a!gridField(
          label: "Read-only Grid",
          labelPosition: "ABOVE",
          data: a!recordData(
            'recordType!{SYSTEM_RECORD_TYPE_USER}User',
            {
              a!queryFilter(
                "myField",
                "in",
                local!selectedRows["RecordType.fields.id"],
                local!filterSelectedRows
              )
            }
          ),
          columns: {},
          selectable: true,
          selectionValue: local!selectedRows,
          selectionSaveInto: {
            local!selectedRows
          },
          validations: {}
        ),
        a!linkfield(
          links: {
            a!dynamicLink(
              label: if(
                local!filterSelectedRows,
                "Unfilter selected rows",
                "Filter selected rows"
              ),
              value: not(local!filterSelectedRows),
              saveInto: local!filterSelectedRows
            )
          }
        )
      }
    )
    

  • 0
    Certified Associate Developer
    in reply to Danny Verb

    Thank you!!

    Got it done simply.
    Was REALLY helpful!!