filteredCellValue method
dynamic
filteredCellValue({
- required PlutoColumn column,
- dynamic newValue,
- dynamic oldValue,
inherited
Filter on cell value change
Implementation
@override
dynamic filteredCellValue({
required PlutoColumn column,
dynamic newValue,
dynamic oldValue,
}) {
if (column.type.isSelect) {
return column.type.select.items.contains(newValue) == true
? newValue
: oldValue;
}
if (column.type.isDate) {
try {
final parseNewValue =
column.type.date.dateFormat.parseStrict(newValue.toString());
return PlutoDateTimeHelper.isValidRange(
date: parseNewValue,
start: column.type.date.startDate,
end: column.type.date.endDate,
)
? column.type.date.dateFormat.format(parseNewValue)
: oldValue;
} catch (e) {
return oldValue;
}
}
if (column.type.isTime) {
final time = RegExp(r'^([0-1]?\d|2[0-3]):[0-5]\d$');
return time.hasMatch(newValue.toString()) ? newValue : oldValue;
}
return newValue;
}