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

[data grid] filter apply only when click on button of "apply button" #10938

Open
andytsoi1 opened this issue Nov 8, 2023 · 7 comments
Open
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature waiting for 👍 Waiting for upvotes

Comments

@andytsoi1
Copy link

andytsoi1 commented Nov 8, 2023

Summary 💡

The current x-data-grid filter panel is filtering after user input, but I don't want it to filter every time user input, I want to have a "apply filter" button on the footer, so it only filters when user click that button.

Examples 🌈

No response

Motivation 🔦

When we do backend filter, we don't want to waste network api request when user have not finish the filter selection and submitting meaning less api request.

Search keywords: datagrid GridPanelPanel filter

@andytsoi1 andytsoi1 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 8, 2023
@romgrk romgrk added component: data grid This is the name of the generic UI component, not the React module! waiting for 👍 Waiting for upvotes feature: Filtering Related to the data grid Filtering feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 8, 2023
@cherniavskii cherniavskii moved this to 🆕 Needs refinement in MUI X Data Grid Mar 21, 2024
@cherniavskii
Copy link
Member

cherniavskii commented Apr 23, 2024

Related issue: the filters are always applied when the user opens the filter panel. This can be avoided.

We can explore two options here:

  1. Operate on the local state in the filter panel, and update the global filter state when necessary (on "Apply" button click or as you type (default)). This can also solve the issue described above.
  2. Put the applyFilters() behind a prop:
    apiRef.current.unstable_applyFilters();

    This way, the grid filter state will always be updated, but the filters won't be applied automatically.
    With this approach, we need to revert the grid filter state if the user closes the filter panel without applying the filters.

Side note: creating a custom filter panel is hard – there's no way to reuse the logic from GridFilterPanel.
This is a higher priority than applying filters on button click.

@ngal-r7
Copy link

ngal-r7 commented Aug 9, 2024

Hello,
Please let us know what is required for this feature to be implemented. The current behavior is impractical to use for server-side filtering.
Thanks

@andytsoi1
Copy link
Author

Hello, Please let us know what is required for this feature to be implemented. The current behavior is impractical to use for server-side filtering. Thanks

Should have a optional param for it, so it doesn't trigger the search onChange, but trigger on click of the "apply" filter button

@jdalzatec
Copy link

As a workaround, you can set a debounce (debounceMs) to wait some milliseconds to make the request to the server. But yes, having a button to apply filters would be much nicer.

@barrar
Copy link

barrar commented Oct 21, 2024

This is a valuable key feature. When using server side filtering logic some operations can take quite a while. It's best to only trigger an update when necessary, such as when an apply button is clicked.

@jerichardson-r7
Copy link

Hey @cherniavskii I saw you moved this into Ready 🙂 does this mean this feature is likely to be worked on soon? We're having issues that an apply button would solve.

@kfowler1337
Copy link

Any update on this being added? M team would be interested in using this. It is less than ideal having filters be applied every time one is added when dealing with server side filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature waiting for 👍 Waiting for upvotes
Projects
Status: 🔖 Ready
Development

No branches or pull requests

8 participants