-
Notifications
You must be signed in to change notification settings - Fork 1k
Make DataTable rowDetails expansion tracked by primary key rather than index #7547
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Mike for working on this and getting something up I just have a couple questions as far as code but I like the behavior thank you for changing the story its nice to have!
I was trying to think of a way we can also write a test for this behavior but that doesnt have to block this PR. One small comment then everything looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great and storybook example is super helpful/realistic thank you, one small comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Mike!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
What does this PR do?
This PR fixes an issue from Kari where DataTables rowDetails expansion was tied to a table index. Being based on index wasn't working very well with filter/sort or pagination.
These changes also introduce the ability to use the details row expansion in a "controlled" mode. For example:
This pattern more closely follows how we do selections as well as grouped row expansions.
I re-wrote the rowDetails story to better show a rowDetails example using the StarWars api. It has more interesting details worth showing in a detail row.
Where should the reviewer start?
DataTable/Body.js
What testing has been done on this PR?
storybook and manual
How should this be manually tested?
Storybook Visualizations/DataTable/rowDetails
Do Jest tests follow these best practices?
screen
is used for querying.asFragment()
is used for snapshot testing.Any background context you want to provide?
From Kari's request:
We've been implementing a feature using the rowDetails prop on DataTable. There are some oddities about how it works, so I'd like to suggest a few enhancements:
What are the relevant issues?
Screenshots (if appropriate)
Do the grommet docs need to be updated?
Yes
Should this PR be mentioned in the release notes?
Yes
Is this change backwards compatible or is it a breaking change?
This change should be backwards compatible since we didn't expose the expansion keys before now. It will also use the index as a key if for some reason it can't find a primary key