carbon-design-system / ibm-products

A Carbon-powered React component library for IBM Products
https://ibm-products.carbondesignsystem.com
Apache License 2.0
98 stars 138 forks source link

Datagrid: add support for selectable nested rows #3887

Open matthewgallo opened 11 months ago

matthewgallo commented 11 months ago

What package(s) are you using?

Detailed description

Describe in detail the issue you're having.

There current is not support for selected nested rows in the Datagrid, however there is design guidance for this variant of Datagrid, see here.

Is this issue related to a specific component?

Datagrid, useNestedRows and useSelectRows

What did you expect to happen? What happened instead? What would you like to see changed?

Expected to be able to use these two plugins together.

What browser are you working in?

Chrome

What version of the @carbon/ibm-products (or @carbon/ibm-cloud-cognitive) package are you using?

Latest

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

N/A

elycheea commented 11 months ago

Acceptance criteria

From discussion on refinement call — Safest route is probably to leave out selection of all children when selecting the parent. This behavior can vary depending on needs. Add select is another example that treats this a bit separately.

Updated Feb 19 — based on default behavior from React Table, we’ve decided to keep selection of nested children.

matthewgallo commented 9 months ago

It appears that react-table forces all child rows to be selected when a parent row is selected, there might be a way to work around this but this appears to be the default behavior.

https://github.com/TanStack/table/blob/v7/src/plugin-hooks/useRowSelect.js#L166-L169