-
-
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] Add filterValueGetter
property to the column definition
#8929
Comments
You can already have that by customizing the operators. Looking at the specific example you gave with seconds, you can also achieve it providing a custom filter component and using a |
Thanks for the answer @m4theushw ! if (params.colDef.type === 'string') {
return innerFilterFn({
...params,
value: params.formattedValue,
})
} I think this approach is fine to handle more complex cases but for simple cases like the example I shared, I think a quick solution through a |
Another use case for |
Note that the |
There is a |
This comment was marked as off-topic.
This comment was marked as off-topic.
@ebengtso Please refer to github's docs for code formatting if you want to share snippets of code, and use stackblitz or codesandbox if you want to share runnable examples. |
Duplicates
Latest version
Summary 💡
Currently, the data grid filters a column based on the
value
if the column has avalueGetter
.In many use cases, we want to use the raw
value
for sorting and theformattedValue
for display. One example is:But if the user filters this column, the filter will not be based on the displayed value as he is expecting. I didn't find a good way to achieve this behavior in the docs.
I believe a value accessor should be used to customize what value should be used to filter.
For instance, a
filterValueGetter
property could be added to the column definition:Inspired from AG Grid:
https://www.ag-grid.com/javascript-data-grid/value-getters/#filter-value-getters
Examples 🌈
A
filterValueGetter
property could be added to the column definition:Inspired from AG Grid:
https://www.ag-grid.com/javascript-data-grid/value-getters/#filter-value-getters
Motivation 🔦
There is no easy way to filter by the displayed value of a column. There should be a property to customized the value to be used in the filters.
Order ID 💳 (optional)
54728
The text was updated successfully, but these errors were encountered: