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

[DataGrid] singleSelect filtering doesn't work for object values without value property #9026

Open
2 tasks done
cherniavskii opened this issue May 17, 2023 · 0 comments
Open
2 tasks done
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! customization: extend Logic customizability feature: Filtering Related to the data grid Filtering feature

Comments

@cherniavskii
Copy link
Member

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/damp-shadow-xemby7?file=/demo.tsx

Steps:

  1. Filter the country2 column using is operator and Andorra value

Current behavior 😯

No rows displayed

Screen.Recording.2023-05-17.at.19.44.15.mov

Expected behavior 🤔

The rows with Andorra value displayed

Context 🔦

I noticed this while reviewing DataGrid + Joy UI demo for the workshop.

The problem is reproducible only when:

  1. The object is being used as a cell value
  2. The object doesn't have a value property

In the demo, the country1 column works as expected, because valueOptions and the cell value have the value property.

In #7684 we added support for getOptionValue, but apparently we missed something.
The issue is probably here:

const parseObjectValue = (value: unknown) => {
if (value == null || !isObject<{ value: unknown }>(value)) {
return value;
}
return value.value;
};

We should use getOptionValue here instead of the hardcoded .value

Your environment 🌎

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

Order ID or Support key 💳 (optional)

No response

@cherniavskii cherniavskii added bug 🐛 Something doesn't work 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 customization: extend Logic customizability labels May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! customization: extend Logic customizability feature: Filtering Related to the data grid Filtering feature
Projects
None yet
Development

No branches or pull requests

1 participant