removeColumnGroup method

void removeColumnGroup(
  1. ColumnGroup columnGroup
)

Call this method to remove a specified ColumnGroup from the column grouping.

Implementation

void removeColumnGroup(ColumnGroup columnGroup) {
  final DataGridConfiguration dataGridConfiguration =
      _dataGridStateDetails!();
  if (_groupedColumns.isNotEmpty && _groupedColumns.contains(columnGroup)) {
    if (dataGridConfiguration.currentCell.isEditing) {
      dataGridConfiguration.currentCell
          .onCellSubmit(dataGridConfiguration, canRefresh: false);
    }
    if (columnGroup.sortGroupRows) {
      final SortColumnDetails? sortedColumn = sortedColumns.firstWhereOrNull(
          (SortColumnDetails element) => element.name == columnGroup.name);
      if (sortedColumn != null) {
        sortedColumns.remove(sortedColumn);
      }
    }

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