-
-
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] Customize FilterPanel
with props
#3497
Merged
Merged
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
9afd3f4
add props to filter panel
alexfauquette 129e939
add doc
alexfauquette 0af7213
set default values
alexfauquette 93e7aa3
small PR feedbacks
alexfauquette bd3fcdd
use class override for style modification
alexfauquette 7651d6b
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette 3c9de83
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette d421ad9
scripts
alexfauquette 01dbe3e
markdownlint
alexfauquette 5b50bf0
Apply suggestions from code review
alexfauquette 3560f2b
typing feedbacks and avoid breaking changes
alexfauquette 2855ab6
update classes names
alexfauquette d8c41ac
pass props to filterForm FormeControl
alexfauquette 7d39cd8
proptypes
alexfauquette 15630d7
remove required
alexfauquette 87e656a
update doc explainations
alexfauquette 1b16222
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette 3d7b052
update styling
alexfauquette 3936174
update doc table
alexfauquette 9d3e4fa
fix tests
alexfauquette 8170224
add classes
alexfauquette 7ff5e6c
match clesse properties with slot names
alexfauquette 08225c9
update CSS doc
alexfauquette 808261e
update doc example
alexfauquette 00f7cd1
use styled without memo
alexfauquette 9dcadb0
add label for outlined input
alexfauquette b2e6453
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette 7e659ab
docs:typescript:formatted
alexfauquette 6c6d6a9
Jose feedback
alexfauquette 84f4e16
mat feedbacks on typing
alexfauquette 29bd314
language
alexfauquette 6d5c487
yarn proptypes
alexfauquette 72d2886
fix lint
alexfauquette 64e7767
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette 04a5331
feedbacks
alexfauquette f10cb3d
add files removed during migration
alexfauquette 7127c06
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette 3c8dbf7
Fix demo migration
alexfauquette ec687de
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette cc8ef3e
Merge remote-tracking branch 'upstream/master' into customize-filters
alexfauquette File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -235,7 +235,8 @@ In the demo below, the `rating` column only has the `<` and `>` operators. | |||||
### Edit an operator | ||||||
|
||||||
The value used by the operator to look for has to be entered by the user. | ||||||
On most column types, a text field is used. However, a custom component can be rendered instead. | ||||||
On most column types, a text field is used. | ||||||
However, a custom component can be rendered instead. | ||||||
|
||||||
In the demo below, the `rating` column reuses the numeric operators but the rating component is used to enter the value of the filter. | ||||||
|
||||||
|
@@ -259,9 +260,34 @@ const ratingColumnType: GridColTypeDef = { | |||||
|
||||||
You can customize the rendering of the filter panel as shown in [the component section](/components/data-grid/components/#overriding-components) of the documentation. | ||||||
|
||||||
### Customize the filter panel content | ||||||
|
||||||
The customization of the filter panel content can be performed by passing props to the default `<GridFilterPanel />` component. | ||||||
The available props allow to override: | ||||||
|
||||||
- The available `linkOperators` (can contains `GridLinkOperator.And` and `GridLinkOperator.Or`) | ||||||
- The order of the column selector (can be `"asc"` or `"desc"`) | ||||||
- Any prop of the input components | ||||||
|
||||||
Input components can be [customized](/customization/how-to-customize/) by using two approaches. | ||||||
You can pass a `sx` prop to any input container or you can use css selectors on nested components of the filter panel. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
More details are available in the demo. | ||||||
|
||||||
| Props | Class | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| :----------------------- | :---------------------------------------- | | ||||||
| `deleteIconProps` | `MuiDataGrid-filterFormDeleteIcon` | | ||||||
| `linkOperatorInputProps` | `MuiDataGrid-filterFormLinkOperatorInput` | | ||||||
| `columnInputProps` | `MuiDataGrid-filterFormColumnInput` | | ||||||
| `operatorInputProps` | `MuiDataGrid-filterFormOperatorInput` | | ||||||
| `valueInputProps` | `MuiDataGrid-filterFormValueInput` | | ||||||
|
||||||
{{"demo": "pages/components/data-grid/filtering/CustomFilterPanelContent.js", "bg": "inline"}} | ||||||
|
||||||
### Customize the filter panel position | ||||||
|
||||||
The demo below shows how to anchor the filter panel to the toolbar button instead of the column header. | ||||||
|
||||||
{{"demo": "CustomFilterPanel.js", "bg": "inline", "defaultCodeOpen": false}} | ||||||
{{"demo": "CustomFilterPanelPosition.js", "bg": "inline", "defaultCodeOpen": false}} | ||||||
|
||||||
## Server-side filter | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's already "available" in the previous line.