DataTable update to add state props to manage expanded rows externally#459
Open
paulsson wants to merge 1 commit intoMetroStar:mainfrom
Open
DataTable update to add state props to manage expanded rows externally#459paulsson wants to merge 1 commit intoMetroStar:mainfrom
paulsson wants to merge 1 commit intoMetroStar:mainfrom
Conversation
jbouder
requested changes
Feb 25, 2026
Collaborator
jbouder
left a comment
There was a problem hiding this comment.
Without getting too much into the review, we're going to also need the following:
- Add/Update Unit Tests for this new functionality
- Add/Update Stories for this new functionality.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
=======================================
Coverage 99.59% 99.59%
=======================================
Files 51 51
Lines 995 997 +2
Branches 344 346 +2
=======================================
+ Hits 991 993 +2
Misses 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updates DataTable to add 2 new optional props for managing/sharing expanded row state outside of the DataTable. If these state props are passed in via props then the DataTable uses them for managing expanded rows, otherwise internal state is used.
Related Issue
See email discussion below with Johnny Bouder.
Motivation and Context
Discussed with Johnny Bouder via email:
We’d like the ability to have an expand/collapse all button in the header of DataTable when using the prop expandable=true.
Would this happen to already be on your roadmap? If not, we wouldn’t mind implementing this and opening a pull request. If we want to contribute and open a pull request, can/should we do so from our personal GitHub
account?
We had 2 options for an approach to add this functionality:
Basically, it would be moving the internal state at this line to the parent component:
https://github.com/MetroStar/comet/blob/main/packages/comet-extras/src/components/data-table/data-table.tsx#L102
Please let us know your thoughts around this.
Johnny reply:
This is not currently on any roadmap, so you can feel free to jump on it. And any GitHub account is fine.
Lastly, I would prefer going with option 2, as it does provide much more potential later.
Let me know if you have any other questions.
How Has This Been Tested?
Tested in Storybook as well as copied into our existing project with DataTables that track expanded row state internally and a new DataTable that uses this new code to track expanded row state externally in the parent.
Screenshots (if appropriate):