sokida
sokida

Reputation: 539

react-data-table-component expandableRows pass for each parent row a different expandableRowsComponent

I have created a Table using react-data-table-component and now I would like to make the table rows expandable such that when I expand a row it displays details specific to that row.

I read the react-data-table-component API documentation and its possible to have expandable rows by setting expandableRows to true and assigning a component to expandableRowsComponent. But how can I pass data to expandableRowsComponent such that if I expand row 1 I get data lets say "This is row 1", for row 2 I'll get "This is row 2" and so on...

Any help or guidance would be much appreciated. Thanks!

Upvotes: 0

Views: 2835

Answers (1)

Hardik Virani
Hardik Virani

Reputation: 1755

Go through the detailed documentation here https://react-data-table-component.netlify.app/?path=/docs/expandable-basic--basic

You will find all the details property which are using for collapse table components and all other helpful props and types with Typescript. See in link there is good example as well for collapse table that will help you to make your collapse components.

Upvotes: 1

Related Questions