-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Fix values labels in is any of
filter operator
#11939
Conversation
Deploy preview: https://deploy-preview-11939--material-ui-x.netlify.app/ |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@cherniavskii This PR is ready for review |
@MBilalShafi adding you as reviewer since @cherniavskii is OOO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, seems to work as expected now!
resolvedValueOptions?.find((resolvedValue) => getOptionValue(resolvedValue) === value), | ||
) | ||
.filter((value) => value !== undefined) as ValueOptions[]; | ||
}, [getOptionValue, item.value, resolvedValueOptions]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe do in one go?
diff --git a/packages/x-data-grid/src/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.tsx b/packages/x-data-grid/src/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.tsx
index 517860549..1d274b335 100644
--- a/packages/x-data-grid/src/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.tsx
+++ b/packages/x-data-grid/src/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.tsx
@@ -79,11 +79,15 @@ function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingl
return [];
}
- return item.value
- ?.map((value) =>
- resolvedValueOptions?.find((resolvedValue) => getOptionValue(resolvedValue) === value),
- )
- .filter((value) => value !== undefined) as ValueOptions[];
+ return item.value.reduce<ValueOptions[]>((acc, value) => {
+ const resolvedValue = resolvedValueOptions.find(
+ (v) => getOptionValue(v) === value,
+ );
+ if (resolvedValue != null) {
+ acc.push(resolvedValue);
+ }
+ return acc;
+ }, [] as ValueOptions[]);
}, [getOptionValue, item.value, resolvedValueOptions]);
const handleChange = React.useCallback<
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The adjustment has been made @MBilalShafi, thanks for the review.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Co-authored-by: jasmyneokudo <[email protected]> Co-authored-by: seunexplicit <[email protected]>
Thanks @gitstart 🙇🏼 |
is any of
filter operator
is any of
filter operatoris any of
filter operator
…for "is any of" starting from 7.0.0-alpha.7 (mui#11939) Co-authored-by: jasmyneokudo <[email protected]> Co-authored-by: seunexplicit <[email protected]>
Description
SIngleSelect columns now displays label property instead of value property
Closes 11755
Refs
Loom Video
This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.