-
-
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] Implement multipleSelect column type #11325
base: master
Are you sure you want to change the base?
Conversation
SYnc with upstream next
Localization writing tips ✍️Seems you are updating localization 🌍 files. Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️
Deploy preview: https://deploy-preview-11325--material-ui-x.netlify.app/ Updated pages: |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@martinjlowm Sorry about the delay and the merge conflicts, we're in the process of releasing v7 so the breaking changes have been taking priority as we only release a major version once a year. If you can solve the conflicts for the current head commit, I'll review the PR. |
@romgrk there you go 👍 |
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.
Not sure why this file has this diff, maybe something happened to it on the default branch.
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 commit comes from a Pretter run - just took a look at the diff off GitHub and there it looks like there are two additional spaces in the first column prior to this.
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.
Never mind - thought your comment was pinned to the column definition file. It's renamed to index.md now.
valueFormatter(params) { | ||
const { id, field, value, api } = params; |
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.
Will conflict with #11573, need to watch out for this one.
if (!isMultipleSelectColDef(colDef)) { | ||
return []; | ||
} |
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.
Is this check necessary if the formatter is for this column?
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.
This formatter returns []
in a few places, isn't it supposed to return a string?
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.
Good question - it's a continuation of Jim's work. I'd agree that streamlining the return type here makes sense.
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.
https://mui.com/material-ui/api/autocomplete/#autocomplete-prop-multiple - we explicitly set multiple on the autocomplete component, but that I would assume would mean that the succeeding string branches should be arrays as well.
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.
But IIUC, valueFormatter
is only for formatting to string. One of its use-cases is filtering (full-text search). I'm not sure how else it's used. Maybe someone else can add more context.
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.
https://next.mui.com/x/react-data-grid/column-definition/#value-formatter says:
Note, that the value returned by valueFormatter is only used for rendering purposes. Filtering and sorting are based on the raw value (row[field]) or the value returned by valueGetter.
But this is wrong, the quickfilter code uses the formatted values for its filtering.
packages/grid/x-data-grid/src/colDef/gridMultipleSelectOperators.ts
Outdated
Show resolved
Hide resolved
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.
Can't wrap my head about the double Multiple
in the file name, would you mind explaining what it refers to? Having more than one multiple-select?
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.
I think the idea was that the multipleSelect type was used inside an Autocomplete component with the multiple flag set. So an indication of nesting.
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.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
What would I need to do to address this PR being out of date? I'm a Pro customer and this would be very useful for our use case. I would be happy to update the PR. |
This adds a data grid column type for selecting multiple items.
This is based on Jim's work at #8099, see that PR for further details.
Closes
multipleSelect
column type #4410multipleSelect
column type #8099