How to use more record fields in "sortField" of read only grid (Grid uses record data)

Certified Associate Developer

My read only grid is having a column "Emp - Name" where we are concatenating Emp First Name and Emp Last Name and showing under a single column "Emp - Name". Here how to sort this column "Emp - Name" by clicking on the Header with both Emp Last Name and Emp First Name (First sort with Emp First Name then with Emp Last Name).

"sortField" parameter is accepting only one record type field (In this case, i'm able to use either the firstname or the lastname to sort)

Please advise.

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    You can use the initialSorts parameter in expression mode or edit as expression for sort in design mode. This will accept multiple sorts.
    As for the header click sort on demand, can you elaborate on use case here as sorting both fields by clicking on individual headers does not make much sense. We can have full name as a new column that will sort the entire name if required by adding this attribute in DB table as well.

    initialSorts: {
          {
            a!sortInfo(
              field: 'recordType!{...}Record A.fields.{firstName}firstName',
              ascending: true
            ),
            a!sortInfo(
              field: 'recordType!{...}Record A.fields.{lastName}lastName',
              ascending: true
            )
          }
        }

  • 0
    Certified Lead Developer

    Is this a synced Record? If yes, create a custom field holding these joined values and sort on it.