-
-
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
[data grid] Can't group by nested value in fields #14520
Comments
@MBilalShafi could you have a look at this one? Thanks! |
I have found the solution to this problem. The groupingValueGetter method should be defined for extract nested fields: ...
groupingValueGetter: (_value, row) => row.device.model,
... It's confusing. Is it possible to use the |
No, that's not possible. As stated in the docs the Does using that solve your use-case? |
I went through all the discussions on the PR where I created the row grouping to find a reason not to fallback to Not saying that we should change our behavior, just that remember a smart reason not to when we created this feature, it was just not discussed 👍 |
@michelengelen Yes, this solved the problem but I suppose it'll be better to mention in the documentation that the row grouping functionality uses the |
It's documented here |
We could possibly add a callout and a crosslink here: Value getter |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @maxd! How was your experience with our support team? |
Steps to reproduce
I want to group rows by the
model
column butDataGridPremium
can't do this:As you can see the
model
column is empty.MVP for reproducing this problem: link. The MVP is based on the first example from this page.
This happens because
DataGridPremium
can't extract values from fields in nested objects (e.g. fromdevice.model
anddevice.serial_number
fields). Try to uncomment themodel
andserial_number
fields in therows
array. When you make this you'll receive the error:row.device is undefined
. If you fix this (e.g. replacerow.device.???
withrow.device?.xxx
invalueGetter
methods) the grouping will work fine:Current behavior
The
DataGridPremium
can't group by field in nested objects i.e. it can group bymodel
field in such{model: "X"}
row but can't group by the same field in{device: {model: 'x'}}
row whenvalueGetter
extract this value.Expected behavior
The
DataGridPremium
should group by field in nested objects extracted withvalueGetter
method from column definition.Context
No response
Your environment
No response
Search keywords: grouping by nested fields
The text was updated successfully, but these errors were encountered: