onCellBeginEdit method

  1. @override
bool onCellBeginEdit(
  1. DataGridRow dataGridRow,
  2. RowColumnIndex rowColumnIndex,
  3. GridColumn column
)

Called whenever the cell is moved into edit mode.

If you want to disable editing for the cells in specific scenarios, you can return false.

rowColumnIndex represents the index of row and column which are currently in view not based on the actual index. If you want to get the actual row index even after sorting is applied, you can use DataGridSource.rows.indexOf method and pass the dataGridRow. It will provide the actual row index from unsorted DataGridRow collection.

Implementation

@override
bool onCellBeginEdit(DataGridRow dataGridRow, RowColumnIndex rowColumnIndex, GridColumn column) {
  // if (column.columnName == 'id') {
  //   // Return false, to restrict entering into the editing.
  //   return false;
  // } else {
  //   return true;
  // }

  //
  // questo serve a far si che la logica che decide il submit del valore della cella si scateni o no
  cellInEdit_Value = dataGridRow.getCells()[rowColumnIndex.columnIndex].value;
  return true;
}