[data grid] getCellValue
does not work with nested objects when columns use valueGetter
#16120
Labels
component: data grid
This is the name of the generic UI component, not the React module!
customization: logic
Logic customizability
status: waiting for author
Issue with insufficient information
support: commercial
Support request from paid users
support: premium standard
Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
The problem in depth
The provided solution in Issue #13281 suggests using row[field] in the getCellValue function to access values for custom aggregations. However, this approach does not work when columns use a valueGetter and assign values from nested objects.
valueGetter
:For example, if a column is defined like this:
Using row[field] doesn’t retrieve the value.
2. Calculated Fields:
For columns like this:
To use this in custom aggregation, I have to duplicate the logic
(row.value1 + row.value2)
in my custom aggregation function. This feels messy and hard to maintain.I thought of some workarounds, but none are great:
The problem is that my row objects are already complex, and doing this would make them even harder to manage. For example, here’s the kind of data structure I’m working with:
Is there a better way to handle this?
Thankyou.
Your environment
`npx @mui/envinfo`
Search keywords: Custom aggregation with getCellValue
Order ID: 93539
The text was updated successfully, but these errors were encountered: