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

Expanded rows should be controllable #73

Closed
icflorescu opened this issue Sep 27, 2022 · 5 comments
Closed

Expanded rows should be controllable #73

icflorescu opened this issue Sep 27, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@icflorescu
Copy link
Owner

As requested here.

Gist:

The rowExpansion property object should also include:

  • records → currently expanded records
  • onChange → callback fired when currently expanded records change: onChange: (records: T[]) => void
@otobot1
Copy link
Contributor

otobot1 commented Oct 11, 2022

@icflorescu Have you had a chance to work on this issue yet? I can take a crack at it if you haven't.

@icflorescu
Copy link
Owner Author

@otobot1 Not yet, but I will over the weekend.

@icflorescu
Copy link
Owner Author

Done in v1.7.9. Can be used like this:

<DataTable
  // ...
  rowExpansion={{
    // ...
    expanded: {
      recordIds: expandedRecordIds,
      onRecordIdsChange: setExpandedRecordIds,
    },
  }}
/>

Full working example in Controlled mode section of this page.

@icflorescu
Copy link
Owner Author

@otobot1 if you're curious, this is handled mostly in the useRowExpansion hook here.

@otobot1
Copy link
Contributor

otobot1 commented Oct 14, 2022

@otobot1 if you're curious, this is handled mostly in the useRowExpansion hook here.

I'll check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants