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(DataTable): close batch actions when selected items are removed #9679

Conversation

FrivalszkyP
Copy link
Contributor

Closes #9586

Change the shouldShowBatchActions logic to only be true when there is at least one selected row.

Changelog

Changed

  • DataTable getBacthActionProps now takes selectedRows.length into account when returning shouldShowBacthActions, the same way handleOnSelectRow does. The reason for this is the number of selected rows can be changed from outside handleOnSelectRow, for example if the selected row gets deleted in the component that wraps the DataTable.

Testing / Reviewing

Check out the repository, and using the demo component in the DataTable-batch-actions-story.js, implement the logic for the "Delete" button. Let me know if I should provide a test example!

@netlify
Copy link

netlify bot commented Sep 16, 2021

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: aa7aa61

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/6148955139f128000790586b

😎 Browse the preview: https://deploy-preview-9679--carbon-react-next.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Sep 16, 2021

DCO Assistant Lite bot All contributors have signed the DCO.

@FrivalszkyP FrivalszkyP force-pushed the feature/datatable-batch-actions-auto-close branch from 6b25c45 to 4ba5924 Compare September 16, 2021 08:12
@FrivalszkyP
Copy link
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@netlify
Copy link

netlify bot commented Sep 16, 2021

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: 6b25c45

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/6142fc244ed7c30007621332

😎 Browse the preview: https://deploy-preview-9679--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Sep 16, 2021

✔️ Deploy Preview for carbon-components-react ready!
Built without sensitive environment variables

🔨 Explore the source changes: 6b25c45

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/6142fc24ee54c80008447d3b

😎 Browse the preview: https://deploy-preview-9679--carbon-components-react.netlify.app

@FrivalszkyP
Copy link
Contributor Author

recheck

@netlify
Copy link

netlify bot commented Sep 16, 2021

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: aa7aa61

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/6148955109147300080772f2

😎 Browse the preview: https://deploy-preview-9679--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Sep 16, 2021

✔️ Deploy Preview for carbon-components-react ready!
Built without sensitive environment variables

🔨 Explore the source changes: aa7aa61

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/6148955147967a000791ef82

😎 Browse the preview: https://deploy-preview-9679--carbon-components-react.netlify.app

@sstrubberg sstrubberg enabled auto-merge (squash) September 20, 2021 14:06
@sstrubberg sstrubberg merged commit 1254da5 into carbon-design-system:main Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataTable] TableBatchActions remains open when selected rows are removed from the tree
3 participants