toggleFrozenColumn method

  1. @override
void toggleFrozenColumn(
  1. PlutoColumn column,
  2. PlutoColumnFrozen frozen
)
inherited

Toggle whether the column is frozen or not.

When column is changed to a frozen column, the PlutoColumn.frozen is not changed if the frozen column width constraint is insufficient. Unfreeze the existing frozen or widen the entire grid width to set it wider than the frozen column width constraint.

Implementation

@override
void toggleFrozenColumn(PlutoColumn column, PlutoColumnFrozen frozen) {
  if (limitToggleFrozenColumn(column, frozen)) {
    return;
  }

  column.frozen = column.frozen.isFrozen ? PlutoColumnFrozen.none : frozen;

  resetCurrentState(notify: false);

  resetShowFrozenColumn();

  if (!columnSizeConfig.restoreAutoSizeAfterFrozenColumn) {
    deactivateColumnsAutoSize();
  }

  updateVisibilityLayout();

  if (onColumnsMoved != null) {
    onColumnsMoved!(PlutoGridOnColumnsMovedEvent(
      idx: refColumns.indexOf(column),
      visualIdx: columnIndex(column)!,
      columns: [column],
    ));
  }

  notifyListeners(true, toggleFrozenColumn.hashCode);
}