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] Filtering Boolean Columns. Filter Model sends value = true, when false filter is selected. #15225

Closed
AnastasiaEvgenia opened this issue Oct 31, 2024 · 7 comments · Fixed by #15252
Assignees
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 regression A bug, but worse

Comments

@AnastasiaEvgenia
Copy link

AnastasiaEvgenia commented Oct 31, 2024

Steps to reproduce

Link to live example: (required)
https://mui.com/x/react-data-grid/filtering/

Steps:

  1. First grid in documentation
  2. Select filter in 'Is admin' column. First with is true. Second with is false
  3. After selecting is false, you can see that displaying data are still the ones with true value.

Screenshot_493

Current behavior

I debugged this issue in my app. Even if you select false, the filter model sends true.

Filter Model when is true is selected
Screenshot_495

Filter Model when is false is selected.
Screenshot_496

Something could be wrong with the on change handler of the filter selection?

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: boolean, column, filter, error in filter model

Search keywords:

@AnastasiaEvgenia AnastasiaEvgenia added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 31, 2024
@AnastasiaEvgenia AnastasiaEvgenia changed the title Filtering Boolean Columns. Filter Model send true value, when is false filter is selected. Filtering Boolean Columns. Filter Model sends value = true, when false filter is selected. Oct 31, 2024
@zannager zannager transferred this issue from mui/material-ui Nov 1, 2024
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Nov 1, 2024
@arminmeh arminmeh changed the title Filtering Boolean Columns. Filter Model sends value = true, when false filter is selected. [data grid] Filtering Boolean Columns. Filter Model sends value = true, when false filter is selected. Nov 1, 2024
@arminmeh arminmeh added bug 🐛 Something doesn't work feature: Filtering Related to the data grid Filtering feature labels Nov 1, 2024
@arminmeh
Copy link
Contributor

arminmeh commented Nov 1, 2024

Thanks for reporting @AnastasiaEvgenia
I have confirmed the issue and will work on the fix

@arminmeh arminmeh removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 1, 2024
@arminmeh arminmeh self-assigned this Nov 1, 2024
@arminmeh arminmeh added regression A bug, but worse and removed bug 🐛 Something doesn't work labels Nov 2, 2024
@arminmeh
Copy link
Contributor

arminmeh commented Nov 2, 2024

Root cause is the change made in
#14733

@k-rajat19
Copy link
Contributor

Hi @arminmeh ,
the problem seems to be here Boolean("false") evaluates to true, sorry I didn't notice it while working on #14733
I think the better approach to convert values to boolean type is String(value).toLowerCase() === 'true'
we should also probably need to check further that we are handling falsy values correctly or not :(
should I create a PR or are you willing to fix it yourself?

@arminmeh
Copy link
Contributor

arminmeh commented Nov 3, 2024

hey @k-rajat19
if you have time, I would appreciate your help.
Otherwise, I will continue with it

Copy link

github-actions bot commented Nov 4, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@AnastasiaEvgenia How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@AnastasiaEvgenia
Copy link
Author

Hi. Thank you for addressing this issue swiftly.
Can you confirm that the solution will be released on Friday?

@arminmeh
Copy link
Contributor

arminmeh commented Nov 5, 2024

The plan is to have another release by the end of the week and the fix for this issue will be included.

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 regression A bug, but worse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants