Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Extend CellState.filteredCellValue() to allow implement custom PlutoColumnType with proper set new value checks. #132

Open
slavap opened this issue Jan 25, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@slavap
Copy link

slavap commented Jan 25, 2025

Currently there is the following code in CellState.filteredCellValue()

if (column.type.isSelect) {
      return column.type.select.items.contains(newValue) == true
          ? newValue
          : oldValue;
    }

When I'm implementing some custom PlutoColumnType, I would like to have an ability to check newValue by myself.
Please add the following method to PlutoColumnType:

(bool, dynamic) filteredValue({
    dynamic newValue,
    dynamic oldValue,
  }) => (false, newValue);

so I can override it in my custom PlutoColumnType.
And call it from the CellState.filteredCellValue() as the first statement:

final typeResult = column.type.filteredValue(oldValue: oldValue, newValue: newValue);
if (typeResult.$1) return typeResult.$2; 

//... rest of current CellState.filteredCellValue() code
@slavap slavap added the enhancement New feature or request label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant