clearColumnGroups method

void clearColumnGroups()
inherited

Clear all the ColumnGroup from the column grouping.

Implementation

void clearColumnGroups() {
  final DataGridConfiguration dataGridConfiguration =
      _dataGridStateDetails!();
  if (dataGridConfiguration.currentCell.isEditing) {
    dataGridConfiguration.currentCell
        .onCellSubmit(dataGridConfiguration, canRefresh: false);
  }
  for (final ColumnGroup column in _groupedColumns) {
    if (column.sortGroupRows) {
      final SortColumnDetails? sortedColumn =
          dataGridConfiguration.source.sortedColumns.firstWhereOrNull(
              (SortColumnDetails element) => element.name == column.name);
      if (sortedColumn != null) {
        sortedColumns.remove(sortedColumn);
      }
    }
  }

  _groupedColumns.clear();
  if (_dataGridStateDetails != null) {
    _refreshGrouping(dataGridConfiguration);
  }
}