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 and/or operators for column filters #10771

Closed
adibennun opened this issue Oct 22, 2023 · 2 comments
Closed

Data grid and/or operators for column filters #10771

adibennun opened this issue Oct 22, 2023 · 2 comments
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 status: waiting for author Issue with insufficient information

Comments

@adibennun
Copy link

adibennun commented Oct 22, 2023

Steps to reproduce

Link to live example: (required)

Steps flow 1:

  1. Use a data grid
  2. Filter by column x
  3. Filter again by column and use "and" operator. The table will always provide no results in this scenario. It should be restricted to "Or". "And" operator should not be enabled in this scenario.

Steps flow 2:

  1. Use a data grid
  2. Filter by column x
  3. Filter by another column and use "or" operator. This is by 99% not what the user meant. When filtering by multi columns the idea is to get the union of both of them using the "and" operator. "Or operator should not be enabled in this scenario.

Current behavior

Steps flow 1:

  1. Use a data grid
  2. Filter by column x
  3. Filter again by column and use "and" operator. The table will always provide no results in this scenario. It should be restricted to "Or". "And" operator should not be enabled in this scenario.

Steps flow 2:

  1. Use a data grid
  2. Filter by column x
  3. Filter by another column and use "or" operator. This is by 99% not what the user meant. When filtering by multi columns the idea is to get the union of both of them using the "and" operator. "Or operator should not be enabled in this scenario.

Expected behavior

if I am filtering for the same column I need to have only “Or”. "And" will always provide no results in such a scenario and this is simply wrong.
If I am filtering for the different columns I need to have only “And”. Using "or" will not provide the union of the values coming from different column and the result in 99% is not what the user meant.

Context

I was "playing" with the component, wanted to understand the behavior.

Your environment

https://mui.com/x/react-data-grid/filtering/

Search keywords: Data grid and/or operators for column filters
Order ID: 2222

@adibennun adibennun added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 22, 2023
@MBilalShafi MBilalShafi added the component: data grid This is the name of the generic UI component, not the React module! label Oct 23, 2023
@MBilalShafi
Copy link
Member

Thank you for sharing your opinion. I understand your point around multi-filters for same column vs for different columns. However, currently it's a limitation of filtering that it doesn't allow nested conditions like (columnA > 10 OR columnA < 20) AND columnB equals 'Test', it's either OR or AND

You could controllably change the behavior to default to OR or AND. In order to get more detail on how to control a filter, please check the section Controlled filters.

We are working on a new version of filter UI solving the problems that it currently has. I'd appreciate if you leave some feedback on the related issue for that revamp.

@MBilalShafi MBilalShafi added status: waiting for author Issue with insufficient information 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 Oct 23, 2023
@github-actions
Copy link

The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion.

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 status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants