Skip to main content

Grid Events and Callbacks

Keep dataset lifecycle behavior in FdcDataSet and visual interaction behavior in FdcGrid.

Cell changes

FdcGrid(
dataSet: customers,
onCellChanged: (context) {
final field = context.fieldName;
final oldValue = context.oldValue;
final value = context.value;
},
)

Focus transitions

The grid exposes row, column, and exact-cell enter/exit callbacks:

FdcGrid(
dataSet: customers,
onRowEnter: (context) {},
onRowExit: (context) {},
onColumnEnter: (context) {},
onColumnExit: (context) {},
onCellEnter: (context) {},
onCellExit: (context) {},
)

These are notifications, not navigation veto hooks. Validation and posting rules belong in dataset lifecycle events.

Edit permission gates

FdcGrid(
dataSet: customers,
canEditRow: (rowIndex, row) => !row.valueOf<bool>('locked'),
canEditColumn: (rowIndex, column, row) =>
column.fieldName != 'id',
)

Column value lifecycle

Use onValueChanging to transform or reject the pending value and onValueChanged to observe a successful write for that column.