[docs] upsertFilterItem expects filters with an id field #16806
Labels
component: data grid
This is the name of the generic UI component, not the React module!
feature: Filtering on header
Related to the header filtering (Pro) feature
feature: Filtering
Related to the data grid Filtering feature
support: docs-feedback
Feedback from documentation page
Related page
https://mui.com/x/react-data-grid/filtering/header-filters/#renderheaderfilter-method
Kind of issue
Missing information
Issue description
While trying to implement the
renderHeaderFilter
method as described in the docs. I was trying to use a custom filter for all fields. The issue was that all other filters were being cleared when a second filter was added. I found this bug that is very similar to issue: #11793upsertFilterItems
works by comparing theid
of the filter items. However in the example code, we're upserting a filter with noid
field. This works okay if there is only one custom filter being used (like the current docs example does), but it fails when there are multiple.The current example includes:
It would be better as:
There are probably even better ways to populate this ID field, too.
Before I read through the code, I was assuming it was key'd off
field
, but of course this would not work for multiple filters on a single field.The docs should mention the need for filter items with an
id
field.Context
No response
Search keywords: renderHeaderFilter upsertFilterItem
The text was updated successfully, but these errors were encountered: