changeCellValue method

  1. @override
void changeCellValue(
  1. PlutoCell cell,
  2. dynamic value, {
  3. bool callOnChangedEvent = true,
  4. bool force = false,
  5. bool notify = true,
})
inherited

Change cell value callOnChangedEvent triggers a PlutoOnChangedEventCallback callback.

Implementation

@override
void changeCellValue(
  PlutoCell cell,
  dynamic value, {
  bool callOnChangedEvent = true,
  bool force = false,
  bool notify = true,
}) {
  final currentColumn = cell.column;

  final currentRow = cell.row;

  final dynamic oldValue = cell.value;

  value = filteredCellValue(
    column: currentColumn,
    newValue: value,
    oldValue: oldValue,
  );

  value = castValueByColumnType(value, currentColumn);

  if (force == false &&
      canNotChangeCellValue(
        cell: cell,
        newValue: value,
        oldValue: oldValue,
      )) {
    return;
  }

  currentRow.setState(PlutoRowState.updated);

  cell.value = value;

  if (callOnChangedEvent == true && onChanged != null) {
    onChanged!(PlutoGridOnChangedEvent(
      columnIdx: columnIndex(currentColumn)!,
      column: currentColumn,
      rowIdx: refRows.indexOf(currentRow),
      row: currentRow,
      value: value,
      oldValue: oldValue,
    ));
  }

  notifyListeners(notify, changeCellValue.hashCode);
}