removeColumnsInRowGroupByColumn method

  1. @override
  2. @protected
void removeColumnsInRowGroupByColumn(
  1. List<PlutoColumn> columns, {
  2. bool notify = true,
})
inherited

Implementation

@override
@protected
void removeColumnsInRowGroupByColumn(
  List<PlutoColumn> columns, {
  bool notify = true,
}) {
  if (columns.isEmpty || rowGroupDelegate?.type.isByColumn != true) {
    return;
  }

  final delegate = rowGroupDelegate as PlutoRowGroupByColumnDelegate;

  final Set<Key> removeKeys = Set.from(columns.map((e) => e.key));

  isNotRemoved(e) => !removeKeys.contains(e.key);

  final remaining =
      delegate.columns.where(isNotRemoved).toList(growable: false);

  if (remaining.length == delegate.columns.length) {
    return;
  }

  delegate.columns.clear();

  delegate.columns.addAll(remaining);

  _updateRowGroup();
}