Skip to content
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

feat(Datagrid): add default expansion state to useNestedRows #5261

Conversation

matthewgallo
Copy link
Member

@matthewgallo matthewgallo commented May 17, 2024

Closes #5260

This PR provides a way to have rows expanded by default (when they're not included as part of initialState.expandedRowIds). By adding defaultExpanded: true to the row, the useNestedRows hook/plugin will toggle the expansion state so that if it is a new row and should be expanded by default, this is now possible.

There is still an issue opened from @flannanl around expansion states being not kept after rerendering, but there is a separate issue open for this.

What did you change?

packages/ibm-products/src/components/Datagrid/useNestedRows.js

How did you test and verify your work?

Storybook

@matthewgallo matthewgallo requested a review from a team as a code owner May 17, 2024 16:46
@matthewgallo matthewgallo requested review from emyarod and sangeethababu9223 and removed request for a team May 17, 2024 16:46
Copy link

netlify bot commented May 17, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit e0201d3
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/664e134a6444b50008eb2d6c
😎 Deploy Preview https://deploy-preview-5261--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

emyarod
emyarod previously approved these changes May 22, 2024
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Co-authored-by: andrew <emyarod@users.noreply.github.com>
@matthewgallo matthewgallo requested a review from emyarod May 22, 2024 19:25
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! reapproving after latest updates

Copy link
Contributor

@devadula-nandan devadula-nandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthewgallo matthewgallo added this pull request to the merge queue Jun 12, 2024
Merged via the queue into carbon-design-system:main with commit aa4f2a1 Jun 12, 2024
18 checks passed
@matthewgallo matthewgallo deleted the 5260-datagrid-default-expansion-state branch June 12, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Datagrid]: Support specifying initial states for newly added rows in Datagrid
4 participants