-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Providing InputComponentProps to valueInputProps in Filter Panel gives console warning due to props applying to all components in value column #12372
Comments
Hey @StylesTrip ... I think the best option would be to just apply this to the operator you want it to be on, which is the Here is some example code for this: const columns = React.useMemo(
() =>
data.columns.map((col) => {
if (col.field === 'name') {
return {
...col,
filterOperators: getGridStringOperators()
.filter((operator) => operator.value === 'isAnyOf')
.map((operator) =>
operator.value === 'isAnyOf'
? {
...operator,
InputComponentProps: {
...(operator.InputComponentProps || {}),
limitTags: 1,
},
}
: operator,
),
};
}
return col;
}),
[data.columns],
); I am only applying this to the Does this help you? |
Thanks for the reply, @michelengelen! I was hoping for a way to do it in the theme as defaultProps as we provide a theme for our frontend projects to use. If there isn't a clean way to do it there, then this can be a workaround that I can share with those teams. |
@cherniavskii can we provide a more generalistic approach for this? |
No, I don't think so. |
OK, in that case we are sorry, but this seems to be the only way right now to apply this specific prop. I will close this issue now, but feel free to reopen when you have additional related questions. Or open a new issue when you encounter other problems! |
How did we do @StylesTrip? |
In the filter panel for the
DataGrid
, I want to provide some default props in our theme to limit the amount of chips shown in theAutocomplete
component when the user chooses theis any of
operator:I'm doing this via the
InputComponentProps
in thevalueInputProps
forfilterFormProps
:However, it appears that the props I provided are being passed to any component that may appear in the value column in the filter panel. This causes a console warning:
Is there a way to specify which component to pass the props to? Specifically, in the theme when defining default props?
Example (without the theme) here: https://stackblitz.com/edit/react-9gg8tm?file=Demo.tsx
Search keywords:
The text was updated successfully, but these errors were encountered: