performGrouping method

  1. @protected
String performGrouping(
  1. String columnName,
  2. DataGridRow row
)

Called when grouping is applied to the SfDataGrid.groupedColumns.

Overriding this method provides complete control over grouping. It is invoked when each row is being grouped based on a key. Custom grouping can be achieved by returning a key for the rows.

Implementation

@protected
String performGrouping(String columnName, DataGridRow row) {
  return row
          .getCells()
          .firstWhereOrNull(
              (DataGridCell cell) => cell.columnName == columnName)
          ?.value
          ?.toString() ??
      '';
}