gregnb / gregnb/mui-datatables

Cannot validate filter values before they are applied

Open
#1,928 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

## Use case
When `confirmFilters` is true, I'd want to be able to validate the filter values in the filter dialog before the filters are applied and the dialog is closed (i.e., before calling `applyFilters`).

## Current Behavior

`customFilterDialogFooter` function has `currentFilterList` and `applyFilters` as arguments. Since `currentFilterList` contains the old filter values which cannot be used for validation, the problem could be solved by adding `filterList` to the arguments.

As far as I can tell, `customFilterDialogFooter` is the only function that takes `applyFilters` as an argument. For this to work correctly, `applyFilters` should coexist with `filterList` (as arguments). Otherwise the developer must keep their own `filterList` in external state and try to validate that before calling `applyFilters`, which is hacky in my opinion.

## Steps to Reproduce (for bugs)

1.
2.
3.
4.

## Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | 5.8.0 |
| MUI-datatables | 4.2.2 |
| React | 18.1.0 |
| browser | |
| etc | |

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.